Databases SQL Basics Finding the Data You Want Review & Practice with SQL Playgrounds

Jesse Dispoto
Jesse Dispoto
Front End Web Development Techdegree Graduate 14,537 Points

Select all columns with missing data? Help

For the SQL Playground Stage 3: Practice, you are instructed to "-- Find all movies with any missing data" How would you select all columns where data in null? From what I know, you have to specifically select one column after the where clause, so you could do 2 separate queries like

select * from movies where genre is null; and select * from movies where year_released is null;

Both of these columns have missing data. But is there a way to combine these two? Instead of manually looking at the data and then going back and writing which column you see missing data in - instead just explicitly stating to show all columns where data is missing (null)?

1 Answer

KRIS NIKOLAISEN
KRIS NIKOLAISEN
54,164 Points

You can have both conditions in your WHERE clause separated by OR. Basic syntax:

SELECT column1, column2, columnN 
FROM table_name
WHERE [condition1] OR [condition2]...OR [conditionN]