Informatics Practices

Consider the following query :

SELECT name FROM class WHERE subject ............... NULL;

Which comparison operator may be used to fill the blank space in above query ?

  1. =
  2. LIKE
  3. IS
  4. IS NOT

SQL Queries

2 Likes

Answer

IS, IS NOT

Reason — In SQL, to check for NULL values, we must use the IS NULL or IS NOT NULL comparison operators. The "=" operator cannot be used for NULL because NULL represents an unknown value, and comparisons using = (equal to) will not work as expected. The LIKE operator is used for pattern matching with strings.

Answered By

1 Like


Related Questions