PUBLIC OBJECT

SQL "is equal to", <>, and NULL

Time for a complaint about how SQL deals with NULLs.

CREATE TABLE colas ( brand VARCHAR(32) );
INSERT INTO colas ( 'Pepsi' );
INSERT INTO colas VALUES ( 'Coke' );
SELECT * FROM colas WHERE brand <> NULL;

The above select statement does not return { 'Pepsi', 'Coke' }. Instead, it returns 0 rows. This is because I should have written:

SELECT * FROM colas WHERE brand **IS NOT** NULL;

Not a big deal, but it makes my code more complicated. Especially since I'm using PreparedStatements.

All this coding is making me thirsty!