why is that when I use the <> in sql it is not getting the null value

Example I have the following records on column_name "color": blue, red, green, null... when I do a select query .. select * from table_name where color <> red... The sql should return all records except those that have color red, right? Why is it not showing those value that have null as color? Thank you!

Answers


In general, any comparison with NULL returns false. If you want to also get NULL rows, you'll have to explicitly ask for them:

color <> 'red' OR color IS NULL

Need Your Help

BASH Script to start a node.js socket server as a service

linux bash node.js ssh debian

Basically what i want to accomplish, is some sort of script or method for me to start a node.js socket server script, as a service.

IndexedDB getAll in non-Firefox browsers

javascript indexeddb

I am aware that IDBObjectStore.getAll is not part of the IndexedDB standard and that it might never be. But it is implemented in FireFox, and it makes your code prettier if you do have to retrieve ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.