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 How to add Read More Read Less Button using JavaScript? #3 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #4 Solution to the error “Visual Studio Code can’t be opened because Apple cannot check it for malicious software” #5 How to uninstall Cocoapods from the Mac OS? #6 PHP Login System using PDO Part 1: Create User Registration Page

Recently Posted

#Apr 8 JSON.stringify() in JavaScript #Apr 7 Middleware in NextJS #Jan 17 4 advanced ways to search Colleague #Jan 16 Colleague UI Basics: The Search Area #Jan 16 Colleague UI Basics: The Context Area #Jan 16 Colleague UI Basics: Accessing the user interface
You might also like these
Composing and Extracting Components in ReactReactAngular: Templates, directives, data binding, Services and dependency injectionAngularHow to get Current Year, Month and Date in JavaScript?JavaScriptCan We Use For Loop to Loop Through Associative Arrays in PHP?PHPHow to use @each rule with key-value pair in SCSS?SCSSHow to invalidate all existing cookies using Security Keys in WordPress?WordPressAmpersand (Parent Selector) in SCSS (Sass)SCSSHow to add navigation menu in Angular 9 app?AngularHow to install Gulp with WordPress?WordPressSolution for the error Commit failed – exit code 1 received in Desktop GithubMiscellaneousHow to create a Star Ratings using CSS?CSSGive buttons accessible namesUI/UX