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 to Secure Web or Mobile Browsers?MiscellaneousHow to get previous days or next days in PHP?PHPHow To Create a Fullscreen Background Video using CSS and JavaScript?CSSHow to undo Git Commits on Pantheon?MiscellaneousWhat is Conditional Rendering in React?ReactHow does @extend rule work in SCSS (Sass)?SCSSHow to render lists inside a component in React?ReactHow to verify your domain in Google Console with a TXT record?MiscellaneousUse inline if to make a shorter conditional syntax in ReactReactJavaScript Data Types and Data Structures Things to RememberJavaScriptthe box-sizing property in CSSCSSHow to Sort (Shuffle) an Array in Random Order in JavaScript?JavaScript