📞 0339-0387701 (WhatsApp) Contact

« Back to Database & Data Handling (NCCIA)

Which sorting behaviour is common for NULL values?

A. NULLs always sort first in every database
B. NULLs sort first or last depending on the DBMS and ASC or DESC ✅
C. NULLs are never returned in ORDER BY
D. NULLs are treated as the largest value always

Correct Answer: B. NULLs sort first or last depending on the DBMS and ASC or DESC

Explanation

  • NULL ordering is DBMS-dependent; some systems put NULLs first in ASC order and others last.
  • Use NULLS FIRST or NULLS LAST where supported to control it.