MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

SQL

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What is the correct order of clauses in a SQL statement?
A
SELECT, FROM, ORDER BY, WHERE
B
SELECT, FROM, WHERE, ORDER BY
C
SELECT, WHERE, FROM, ORDER BY
D
WHERE, FROM, SELECT, ORDER BY
Explanation: 

Detailed explanation-1: -The correct answer is Select, where, group by, having.

Detailed explanation-2: -In fact, the logical order is this: The FROM clause: First, all data sources are defined and joined. The WHERE clause: Then, data is filtered as early as possible. The CONNECT BY clause: Then, data is traversed iteratively or recursively, to produce new tuples.

Detailed explanation-3: -The ORDER BY clause must come after the WHERE, GROUP BY, and HAVING clause if present in the query. Use ASC or DESC to specify the sorting order after the column name.

There is 1 question to complete.