dots Created with Sketch.
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.

amazon

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

#Jul 22 Is there a CSS parent selector? #Jul 22 Difference between :where and :is in CSS #Jul 22 Does :is() pseudo selector hint at CSS preprocessing in the future? #Jul 22 Control Scrolling with CSS Scroll Snap #Jul 21 Control rendering using CSS content-visibility property #Jul 21 How to use @supports rule in CSS?
You might also like these
Introduction to Angular modules Part 2: NgModules and componentsAngularSelect statement in Postgres with examplesPostgres@forward rule in SCSS (Sass)SCSSHow to CREATE TABLE in SQL with and without using Another Table?SQL/MySQLCan We Use For Loop to Loop Through Associative Arrays in PHP?PHPThe Differences Between HAVING Clause and WHERE Clause in SQLSQL/MySQLKilling A Project Part 1: What criteria should be used to cancel/kill a project?MiscellaneousHow to redirect or load a new document using JavaScript?JavaScriptThe :last-of-type selectorCSSHow to Recognize an Array in JavaScript?JavaScriptSelector Lists and Combinators in SCSS (Sass)SCSSClasses in JavaScript: The BasicsJavaScript