To select distinct salaries of the employees in a department number D001, what should be the sequence of the statement to construct a correct query?
(A) WHERE Deptid = 'D001'
(B) FROM EMPLOYEE
(C) DISTINCT Salary
(D) SELECT
To select distinct salaries of the employees in a department number D001, what should be the sequence of the statement to construct a correct query?
(A) WHERE Deptid = 'D001'
(B) FROM EMPLOYEE
(C) DISTINCT Salary
(D) SELECT
Solution
✅ Correct Option: 2
A SQL query follows the order SELECT, then the column list, then FROM, then WHERE. DISTINCT comes right after SELECT, so the full query is:
SELECT DISTINCT Salary FROM EMPLOYEE WHERE Deptid = 'D001'
(D) SELECT
(C) DISTINCT Salary
(B) FROM EMPLOYEE
(A) WHERE Deptid = 'D001'
DISTINCT is part of the SELECT clause, not a separate clause, and WHERE always comes after FROM.
Related questions:
2025: 20 May Shift 1
2026: 13 May Shift 2
2025: 14 May Shift 1
2025: 13 May Shift 2
2025: 16 May Shift 1