CS FundamentalsModerateGATE CS · PSU (ISRO/BARC)
In logical query processing order, which clause of a SELECT statement is evaluated LAST?
- A. GROUP BY
- B. HAVING
- C. ORDER BY
- D. SELECT
Correct answer: C. ORDER BY
The logical order is FROM → WHERE → GROUP BY → HAVING → SELECT → (DISTINCT) → ORDER BY (then LIMIT/OFFSET). That is why ORDER BY may use SELECT aliases but WHERE cannot.
More DBMS and SQL questions
- R(A, B, C, D, E, F) has FDs C → AD, EF → C, B → A, AD → E. Each option is a relation schema obtained by projecting R, with the…
- Table Product(pid, cat, price) rows: (1, 'X', 10), (2, 'X', 20), (3, 'Y', 20), (4, NULL, 30), (5, 'Y', NULL), (6, 'Z', 5). What does this…
- A B+ tree has at most 21 children per internal node and at most 20 keys per leaf. A non-root internal node must have at least ⌈21/2⌉…
- R(A, B, C, D, E) with functional dependencies B → A, E → D, D → C is decomposed into R1(A, B), R2(A, C), R3(C, D, E). Which statement is…
- Classify the schedule R3(A), W1(B), R1(A), R3(B), W2(B), R2(A), R2(B), W3(B).
- R(A, B, C, D, E, F) has functional dependencies F → AB, D → C, C → F, CE → D. How many superkeys does R have?