SQL Null Values

In SQL, ‘Null’ represents the absence of a value or an unknown value. It is used to signify that a […]

In SQL, ‘Null’ represents the absence of a value or an unknown value. It is used to signify that a data field does not contain any data or that the value is missing. Having a ZERO value and NO value is not the same.

SQL Null Values Syntax

SQL Null Values Inserting NULL Values Syntax

SQL

SQL Null Values Updating to NULL Syntax

SQL

SQL Null Values Selecting Non-NULL Values

SQL


Tutorials dojo strip

SQL Null Values Example

SQL Null Values Inserting NULL Values Example

This query effectively adds a record for a patient named Alice Brown, born on April 23,1991, with the gender indicated as female. The patient’s contact number is not included, which is acceptable due to the contact_number column allowing NULL values.

SQL




SQL Null Values Updating a Column to NULL

This query effectively updates the record for the patient with patient_id 12 by setting the contact_number to NULL. This means the contact number for this specific patient is now absent or undefined, and this update is applied only to the record with patient_id = 12.

SQL




SQL Null Values Selecting Records with NULL Values Example

This query retrieves the first_name and last_name of all patients from the Patients table where the contact_number is set to NULL. This means it will return the names of patients who do not have a recorded contact number.

SQL




SQL Null Values Selecting Records with Non-NULL Values Example

This query retrieves the first_name, last_name, and contact number of all patients from the Patients table where the contact_number is not NULL.

SQL




SQL Null Values Visual Diagram




SQL Null Values Labs

Tutorials dojo strip