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 trialAndrew Federico
7,498 PointsBug in quiz
https://teamtreehouse.com/library/sql-reporting-by-example/day-1-joining-tables/day-1-review
- What does SELECT NULL = NULL; return? I wanted to point out that it will return a syntax error using the equal comparison operator. SELECT NULL ISNULL; would return NULL however. This question is incorrect.
1 Answer
Steven Parker
231,248 PointsAny ordinary comparison performed on NULL will return NULL. The same is true for any math operation performed on NULL.
On the other hand, "SELECT NULL IS NULL
" will return 1 (for "true").
If you're skeptical, try them out for yourself in the SQL Playground. Be aware that NULL
will be displayed as an empty field there, but you can always apply the "IFNULL
" function to display something else.
Andrew Federico
7,498 PointsAndrew Federico
7,498 PointsThis must be a difference between SQLite and MSSQL, as I tried it in SSMS and SELECT NULL = NULL; gave a syntax error, but SELECT NULL ISNULL; returned NULL.
Steven Parker
231,248 PointsSteven Parker
231,248 PointsAll SQL vendors do things a bit differently. The course concentrates on things that will be universal, but occasionally it may venture into areas of divergence. But any of those will be based on SQLite.