Question:

Arrange the following SQL clause in the correct order of writing a query:
A. DISTINCT
B. ORDER BY
C. WHERE
D. SELECT
Choose the correct answer from the options given below:

Show Hint

Remember the chronological syntax rule: SELECT $\rightarrow$ DISTINCT $\rightarrow$ FROM $\rightarrow$ WHERE $\rightarrow$ GROUP BY $\rightarrow$ HAVING $\rightarrow$ ORDER BY.
The DISTINCT modifier always attaches directly to the front of the projected column list inside SELECT!
Updated On: Jun 11, 2026
  • D, A, C, B
  • A, B, C, D
  • B, A, D, C
  • D, B, A, C
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation


Step 1: Understanding the Question:

The question requires arranging the given SQL query clauses (A: DISTINCT, B: ORDER BY, C: WHERE, D: SELECT) in their correct syntactic sequence as they are structured when writing a query.

Step 2: Syntactic Order of SQL Clauses:
The standard syntax order for any SELECT query in SQL follows this rule: \[ \texttt{SELECT} \rightarrow \texttt{DISTINCT} \rightarrow \texttt{FROM} \rightarrow \texttt{WHERE} \rightarrow \texttt{GROUP BY} \rightarrow \texttt{HAVING} \rightarrow \texttt{ORDER BY} \]

Step 3: Detailed Explanation:

Let us map the given fragments into the standard structure of a query:
- The query always begins with the SELECT command (D) to declare the projection columns.
- If we want to eliminate duplicate rows, the DISTINCT keyword (A) immediately follows the SELECT keyword.
- After identifying the tables in the FROM clause (not listed in this question), we use the WHERE clause (C) to specify row filtering conditions.
- Finally, the ORDER BY clause (B) is placed at the end of the query to specify the sorting criteria for the returned rows.
- Therefore, the correct chronological sequence is:
1. D (SELECT)
2. A (DISTINCT)
3. C (WHERE)
4. B (ORDER BY)
- This order is represented by the sequence: D, A, C, B.

Step 4: Final Answer:

The correct syntactic sequence of writing the SQL clauses is D, A, C, B.
Hence, option (A) is the correct choice.
Was this answer helpful?
0
0