Question:

Suppose you want to select distinct salaries working in department 101 from the 'Employee' relation. What will be the correct order of writing the query?
(A) FROM Employee
(B) SELECT
(C) WHERE
(D) DISTINCT Salary
(E) Dept_ID= 101
Choose the correct answer from the options given below:

Show Hint

Standard SQL syntax order:
SELECT \(\rightarrow\) FROM \(\rightarrow\) WHERE \(\rightarrow\) GROUP BY \(\rightarrow\) HAVING \(\rightarrow\) ORDER BY.
The DISTINCT keyword must directly follow SELECT.
Updated On: Sep 7, 2026
  • (A), (B), (C), (D), (E)
  • (A), (C), (B), (D), (E)
  • (B), (D), (A), (C), (E)
  • (B), (E), (C), (D), (A)
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is C

Solution and Explanation

Concept:
Structured Query Language (SQL) adheres to a strict syntax grammar when constructing Data Query Language (DQL) statements.
The standard clause order for a basic filtering query is: \[ \text{SELECT} \rightarrow \text{attribute list} \rightarrow \text{FROM} \rightarrow \text{table} \rightarrow \text{WHERE} \rightarrow \text{conditions} \]

Step 1: Identifying the Target SQL Query:

The goal is to retrieve unique values of Salary from the Employee table for employees belonging to department 101.
The correct SQL statement is:
SELECT DISTINCT Salary FROM Employee WHERE Dept_ID = 101;

Step 2: Ordering the Given Components:

Mapping each snippet:
1. SELECT \(\rightarrow\) (B)
2. DISTINCT Salary \(\rightarrow\) (D)
3. FROM Employee \(\rightarrow\) (A)
4. WHERE \(\rightarrow\) (C)
5. Dept_ID = 101 \(\rightarrow\) (E)
Thus, the correct grammatical sequence is (B), (D), (A), (C), (E).
Final Answer:
The sequence that builds the valid SQL query is (B), (D), (A), (C), (E). Hence, option (C) is correct.
Was this answer helpful?
0
0