Skip to main contentSkip to solution

Which of the following query will correctly retrieve the names in uppercase of all those who joined in year 2022 , from emp table ?

Note: Consider 'name' as the column containing names of the employees and 'doj' is the field containing date of joining of employees.

Solution

✅ Correct Option: 1

UPPER(name) converts each name to uppercase, and WHERE YEAR(doj)=2022 keeps only rows whose joining year is 2022. The clause order is also correct: SELECT, FROM, then WHERE.


Option 2: MONTHNAME(doj) returns a month name such as 'March', so it can never equal '2022'.

Option 3: the WHERE clause is placed before FROM, which is a syntax error.

Option 4: GROUP BY groups rows and does not filter them. Use WHERE for row conditions.

Keyboard Shortcuts

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