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 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
perspective property in CSSCSSHow to enable GD library support for PHP on windows server?PHPCan We Use For Loop to Loop Through Associative Arrays in PHP?PHPWhat are Identifiers in JavaScript?JavaScriptWHERE Clause in PostgresPostgresLearn how to add Scroll Indicator using CSS and JavaScript?CSSWordPress: How to find all posts from a custom post type with multiple custom fields values?WordPressJavaScript arrays: a separate data type or Objects?JavaScriptHow to check if checkbox is checked or not using JavaScript?JavaScriptHow to Skip or Exclude a Specific URL or File From .htaccess Rewrite Rule?PHPWordPress: How to access first and random row values from a repeater field in ACF?WordPressHow to detect if browser supports WebP format on server side PHP script?PHP