Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Postgresql Can't find any entries with `uniqueId NOT IN (null)`

I was wondering why in Postgresql (and maybe other sql-dialets) the following Query leads to no entries (my_table has entires and uniqueid is a PK):

SELECT uniqueid FROM my_table where uniqueid not in (null)

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Since the IN (...) clause has only one item in it, namely NULL, your query is identical to this:

SELECT uniqueid FROM my_table WHERE uniqueid != NULL;

Comparing any column/value against NULL is unknown and will never be true, and hence will never return any records.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading