sql / beginner
Snippet
Checking for Missing Data Using IS NULL
Because NULL represents unknown or missing data, equality operators like = cannot compare NULL values; SQL requires using IS NULL instead.
snippet.sql
sql
1
2
3
SELECT product_name, priceFROM productsWHERE category_id IS NULL;
Breakdown
1
SELECT product_name, price
Chooses product_name and price columns for the output display.
2
FROM products
Designates products as the target database table.
3
WHERE category_id IS NULL;
Filters rows to only include products without an assigned category.