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 trialDarrin Watkins
306 PointsSelect * FROM movies WHERE id or title or year_released or genre IS NULL; getting all results instead of just Nulls why
I should only see two records from this query, instead i am seeing records with No NULL values as well..
3 Answers
Arturo Alviar
15,739 PointsHi Darrin,
Currently, you are only checking if genre IS NULL.
Try adding IS NULL after every column name and before the ors (title IS NULL or year_released IS NULL etc).
Darrin Watkins
306 PointsThanks Arturo, that's what I ended up doing and it worked.. Appreciate your quick response. Question: Is there any other way this can be written to achieve the same result.
Charlie Krell
2,184 PointsHi Darrin,
I know this is old, but I was playing around with trying parenthesis like (title OR year_released) IS NULL. That doesn't seem to work, so I do think you have to use IS NULL each time.
kevin hudson
Courses Plus Student 11,987 PointsYou are misunderstanding the answer statement. The Parenthesis used was to show how to write in the statement. Don't use ().