...
Operating-Systems
April 23, 2024
Question 1872 – Binary-Trees
April 23, 2024
Operating-Systems
April 23, 2024
Question 1872 – Binary-Trees
April 23, 2024

SQL

Question 5

Which of the  following statements are TRUE about an SQL query?

    P:An SQL query can contain a HAVING clause even if it does not have a GROUP BY clause.
    Q:An SQL query can contain a HAVING clause even if it has a GROUP BY clause.
    R: All attributes used in the GROUP BY clause must appear in the SELECT clause.
    S: Not all attributes used in the GROUP BY clause need to appear in the SELECT clause
A
P and R
B
P and S
C
Q and R
D
Q and S
Question 5 Explanation: 
The SQL GROUP BY clause is used in collaboration with the SELECT statement to arrange identical data into groups. This GROUP BY clause follows the WHERE clause in a SELECT statement and precedes the ORDER BY clause. The attributes used in GROUP BY clause must present in SELECT statement.
The HAVING Clause enables you to specify conditions that filter which group results appear in the results. The WHERE clause places conditions on the selected columns, whereas the HAVING clause places conditions on groups created by the GROUP BY clause. So, we cannot use HAVING clause without GROUP BY clause.
Correct Answer: C
Question 5 Explanation: 
The SQL GROUP BY clause is used in collaboration with the SELECT statement to arrange identical data into groups. This GROUP BY clause follows the WHERE clause in a SELECT statement and precedes the ORDER BY clause. The attributes used in GROUP BY clause must present in SELECT statement.
The HAVING Clause enables you to specify conditions that filter which group results appear in the results. The WHERE clause places conditions on the selected columns, whereas the HAVING clause places conditions on groups created by the GROUP BY clause. So, we cannot use HAVING clause without GROUP BY clause.
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!