sql / beginner
Snippet
Checking for Missing Data Using IS NULL Operator
In SQL, NULL represents a missing or unknown value. Because NULL cannot be evaluated using equality operators like '=', the special IS NULL operator must be used.
snippet.sql
sql
1
2
3
SELECT customer_id, emailFROM customersWHERE phone_number IS NULL;
Breakdown
1
SELECT customer_id, email
Specifies the columns to retrieve in the query result.
2
FROM customers
Identifies 'customers' as the source table.
3
WHERE phone_number IS NULL;
Filters for records where the 'phone_number' field has no assigned value (is NULL).