4 ms·
Can't that be determined by looking at the row count? A row count of zero means it doesn't exist. A row count of 1 with a null in the selected column means the
by abtinf 9y ago
Can't that be determined by looking at the row count? A row count of zero means it doesn't exist. A row count of 1 with a null in the selected column means the row exists the column is null.
I avoid the word "empty" when referring to anything SQL related, as it is ambiguous in three value logic.
- mjevans 9y agoSQL syntax, at least what I'm familiar with offhand, makes you explicitly say things such as WHERE (a.cola = b.colb OR a.cola IS NULL OR b.colb IS NULL) or similar syntax but with distinct variations for joining 'left' and 'right' tables on an expression (which, BTW, can be noticeably slower than the WHERE version, depending on which database you're using).
- marcus_holmes 9y agoI think they're referring to outer-joined tables. SELECT a.id, b.name FROM a LEFT JOIN b ON a.id = b.id If you get a NULL in the name field, you don't know if that's because there's no record in b for that id, or if there is a record in b for that id but it has a NULL name value. Sometimes that difference will be important.
- sorkin2 9y agoWhile admittedly this could be seen as a mistake in SQL, you can differentiate by looking at whether b.id is NULL or not.
- marcus_holmes 9y agotrue, but that's not the point the OP was making, I think :)