Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

Jesse Dispoto
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Jesse Dispoto
Front End Web Development Techdegree Graduate 14,538 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

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]