SQL SELECT NULLFirst of all we should know that what null value is? Null values are used to represent missing unknown data. There can be two conditions:
If in a table, a column is optional, it is very easy to insert data in column or update an existing record without adding a value in this column. This means that field has null value. Note: we should not compare null value with 0. They are not equivalent.Where SQL is NULL:How to select records with null values only? (in the marks column) There is an example of student table:
Let's see the query to get all the records where marks is NULL: It will return the following records:
Where SQL is NOT NULL:How to select records with no null values(in marks column)? Let's see the query to get all the records where marks is NOT NULL
Next TopicSQL WHERE Clause |