Yogesh Chauhan's Blog

Check if any column has NULL values in Postgres

in Postgres on December 7, 2020

To check whether a value is or is not null, use the constructs

Syntax:


expression IS NULL
expression IS NOT NULL

or the equivalent, but nonstandard, constructs


expression ISNULL
expression NOTNULL

Do not write expression = NULL because NULL is not “equal to” NULL.

The null value represents an unknown value, and it is not known whether two unknown values are equal. This behavior conforms to the SQL standard.

Example:


SELECT product_name, unit_price 
FROM products 
WHERE supplier_id IS NULL;

//Output

0 rows

Meaning, all the rows have their supplier_id.


Most Read

#1 How to check if radio button is checked or not using JavaScript? #2 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #3 How to add Read More Read Less Button using JavaScript? #4 How to uninstall Cocoapods from the Mac OS? #5 PHP Login System using PDO Part 1: Create User Registration Page #6 How to Use SQL MAX() Function with Dates?

Recently Posted

#Aug 15 Is PHP still good for back-end programming? #Aug 10 How to create a multisite network in WordPress? #Aug 3 How to create a circle that follows a cursor using JavaScript and CSS? #Aug 3 How to make a curtain slider using jQuery and CSS? #Aug 2 How to progressively load images and add a blurry placeholder? #Aug 1 How to create a placeholder loader (throbber) using CSS?
You might also like these
4 ways to create Date Objects in JavaScriptJavaScriptCONCAT and CONCAT_WS Functions in PostgresPostgresHow to compress images with gulp in WordPress?WordPressHow to add onclick event to html elements dynamically using JavaScript?JavaScriptWordPress Plugin: Things to knowWordPressHow to detect if browser supports WebP format on server side PHP script?PHPIN and BETWEEN Operators in SQLSQL/MySQLHow to get start index and end index (as int) of substring in Swift?SwiftHow to convert a number rounding to a specified number of decimals in JavaScript?JavaScript@forward rule in SCSS (Sass)SCSSHow to create a sidebar using pure CSS?CSSHow to add Laravel to WordPress using Sage theme (and install Tailwind CSS)?PHP