KnowledgeBoat Logo

Informatics Practices

Sarthak, a student of class XII, created a table "Class". Grade is one of the columns of this table. To find the details of students whose Grades have not been entered, he wrote the following MySql query, which did not give the desired result:

SELECT * FROM Class WHERE Grade = "Null";

Help Sarthak to run the query by removing the errors from the query and write the correct query.

SQL Queries

1 Like

Answer

The error in Sarthak's code is that he should use the IS NULL comparison instead of = "Null" because the correct syntax to check for NULL values in SQL is to use the IS NULL operator.

The correct query is:

SELECT * FROM Class WHERE Grade IS NULL;

Answered By

1 Like


Related Questions