Database-Management-System
August 29, 2024
Database-Management-System
August 29, 2024
Database-Management-System
August 29, 2024
Database-Management-System
August 29, 2024

Database-Management-System

Question 729
Given the following two statements about SQL
(a) An SQL query can contain HAVING clause only if it has GROUP BY clause.
(b) In an SQL query “SELECT_FROM_WHERE_GROUP BY_HAVING”, HAVING is executed before WHERE.
Which of the following is correct?
A
(a) and (b) are true
B
(a) is true, (b) is false
C
(a) is false, (b) is true
D
(a) and (b) both are false
Question 729 Explanation: 
→ The GROUP BY clause is a SQL command that is used to group rows that have the same values.
→ HAVING clause is used to filter summarized data or grouped data.
→ WHERE clause introduces a condition on individual rows; HAVING clause introduces a condition on aggregations, i.e. results of selection where a single result, such as count, average, min, max, or sum, has been produced from multiple rows
→ As a rule of thumb, use WHERE before GROUP BY and HAVING after GROUP → BY.
→ The order of execution of Clauses i.e FROM > WHERE > GROUP BY > HAVING > DISTINCT > SELECT > ORDER BY.
Correct Answer: B
Question 729 Explanation: 
→ The GROUP BY clause is a SQL command that is used to group rows that have the same values.
→ HAVING clause is used to filter summarized data or grouped data.
→ WHERE clause introduces a condition on individual rows; HAVING clause introduces a condition on aggregations, i.e. results of selection where a single result, such as count, average, min, max, or sum, has been produced from multiple rows
→ As a rule of thumb, use WHERE before GROUP BY and HAVING after GROUP → BY.
→ The order of execution of Clauses i.e FROM > WHERE > GROUP BY > HAVING > DISTINCT > SELECT > ORDER BY.
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!!