Essential Question: How can I test for records that contain null in SQL?
Mastery Objectives:
SWBAT search for items in a SQL table that are null or where the data is empty.
SWBAT search for items in a SQL table that are not null.
Directions: Type the queries into the SQL editor, https://www.w3schools.com/sql/trysql.asp?filename=trysql_is_not_null. Take a screenshot of the results of each query and paste it into google docs and describe what is happening.
Here is the format for writing queries when data is null.
SELECT column_names
FROM table_name
WHERE column_name IS NULL;
Here is the format for writing queries when data is not null.
SELECT column_names
FROM table_name
WHERE column_name IS NOT NULL;
SELECT CustomerName, ContactName, Address FROM Customers WHERE Address IS NULL;
SELECT CustomerName, ContactName, PostalCode FROM Customers WHERE PostalCode IS NULL;
SELECT CustomerName, ContactName FROM Customers WHERE ContactName IS NULL;
SELECT CustomerName, ContactName, Address FROM Customers WHERE Address IS NOT NULL;
SELECT CustomerName, ContactName, PostalCode FROM Customers WHERE PostalCode IS NOT NULL;
SELECT CustomerName, ContactName FROM Customers WHERE ContactName IS NOT NULL;
Create a query that selects every record where they don't have a field that is null