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 ?
- =
- LIKE
- IS
- IS NOT
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.
Related Questions
Which of the following keywords will you use in the following query to display all the values of the column dept_name ?
SELECT ............... dept_name FROM Company;- All
- From
- Distinct
- Name
The …………… clause of SELECT query allows us to select only those rows in the result that satisfy a specified condition.
- Where
- from
- having
- like
In SQL, which command is used to SELECT only one copy of each set of duplicable rows ?
- SELECT DISTINCT
- SELECT UNIQUE
- SELECT DIFFERENT
- All of the above
Which of the following types of table constraints will prevent the entry of duplicate rows?
- Unique
- Distinct
- Primary Key
- NULL