Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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]