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

How to select all row with missing values?

Following is my code, I believe there is a better way.

SELECT * FROM movies WHERE id IS NULL OR title IS NULL OR year_released IS NULL OR genre IS NULL;

Thanks for helping out!

1 Answer

Steven Parker
Steven Parker
229,966 Points

A primary key cannot be null, so you can skip testing the "id" field.

Other than that, I think you've got it! :+1:

But didn't that database also have a "rating" field? Perhaps I'm thinking of a different exercise. In future questions, please always include a link to the course page you are working with.

Thanks for letting me know! Will include course page from now haha.

In this exercise, the rating field is in the review table.

Thank you!