Skip to main contentSkip to solution

Consider the relation 'EMPLOYEE' : [EmpNo, Ename, Salary,Bonus, DeptId]

Which among the following SQL query will display the unique department number for all the employees from the given 'EMPLOYEE' relation?

Solution

✅ Correct Option: 4

The DISTINCT keyword removes duplicate rows from the result, so select DISTINCT DeptId from EMPLOYEE; lists each department number only once.


Option 1: ALL is the default and keeps duplicates, so a DeptId repeats once for every employee in that department.

Option 2: UNIQUE is not a standard SQL keyword in a SELECT list. It is used for constraints, and only a few databases such as Oracle accept it as a synonym for DISTINCT.

Option 3: DIFFERENT is not an SQL keyword.

Keyboard Shortcuts

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