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

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
How does @extend rule work in SCSS (Sass)?SCSSHow to add Date and Time picker in HTML and get the values using JavaScript?HTMLFilling a button background from left to right using CSSCSSJavaScript Input Validation Theme Park Example using throw StatementJavaScript3 Common Usability Mistakes In Web DesignUI/UXDynamically generate names in SCSS (animation example)SCSSHow to Use password_hash and password_verify to Secure Your User’s Data (Especially Passwords)?PHPHow to Install Xcode Command Line Tools on MacOS?MiscellaneousAngular 9 time clock update every minute, second, hourAngularWhat’s a Closure in JavaScript?JavaScriptbin2hex() and chr() String Functions in PHPPHPSolution to pod install fails with json error on Mac OS X 10.15 (or Mac OS Catalina)Miscellaneous