3,373 views
0 0 votes
From the following statements which of them is/are true about SQL

a) All attributes used in the group by clause must appear in the select clause

b) An SQL query can contain a having clause only if it has a group by clause

c) An SQL query can contain a having clause even if it does not have a group by clause

d) Not all attributes used in the group by clause need to appear in the select clause

1 Answer

0 0 votes

Option A :

A group by command need to be applied to some attribute. So minimum of one attribute must be selected using select command.

Option B: 

Having command is used to qualify the group by command.

So having depends on group by.

 

Option  A and B are true!

Position:
Show:

Related questions

3 3 votes
1 1 answer
272
272 views
GO Classes asked Sep 3
272 views
Suppose the relation $R(A)$ exists and currently contains several tuples.The following SQL statements are executed in sequence:$\text{DELETE\ FROM\ R;}$$\text{INSERT\ INT...
3 3 votes
1 1 answer
153
153 views
GO Classes asked Sep 3
153 views
Consider the relation$\text{Student(sid,\ name,\ age)}$where the attributes occur in the schema in the order shown.Which of the following statements correctly inserts the...
1 1 vote
1 1 answer
139
139 views
GO Classes asked Sep 3
139 views
A relation $R(A,B)$ currently contains $7$ tuples.The following SQL statement is executed:$\text{ALTER\ TABLE\ R\ ADD\ C\ INTEGER;}$Immediately after this command, and be...
2 2 votes
1 1 answer
124
124 views
GO Classes asked Sep 3
124 views
A table contains the following attributes:$\text{code\ CHAR(6)}$$\text{name\ VARCHAR(10)}$Which of the following statements are correct?A value of $\text{code}$ has a fix...