Junior SQL

What is NULL in SQL and how is it handled?

NULL represents the absence of a value in a column. It is not the same as an empty string or

zero.

  • Handling NULL:
  • To check for NULL, use IS NULL or IS NOT NULL.
  • To handle NULL in queries, use COALESCE() (returns the first non-NULL

value) or IFNULL().

Example:

SELECT Name, IFNULL(Salary, 0) FROM Employees;

More from SQL Server Tutorial

All questions for this course