Skip to main contentSkip to solution

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

Solution

✅ Correct Option: 3

The query is SELECT DISTINCT Salary FROM Employee WHERE Dept_ID = 101\text{SELECT DISTINCT Salary FROM Employee WHERE Dept\_ID = 101}, and SQL requires the clauses in this fixed order: SELECT, then FROM, then WHERE.

Correct order:

(B) SELECT

(D) DISTINCT Salary

(A) FROM Employee

(C) WHERE

(E) Dept_ID= 101


Options 1 and 2: both start with FROM, but SQL starts with SELECT.

Option 4: it puts the condition before the table name, which is not valid syntax.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question