YogeshChauhan . com

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.

dreamhost

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 uninstall Cocoapods from the Mac OS? #4 How to add Read More Read Less Button using JavaScript? #5 How to Use SQL MAX() Function with Dates? #6 PHP Login System using PDO Part 1: Create User Registration Page

Recently Posted

May 5 Use inline if to make a shorter conditional syntax in React May 4 What is Conditional Rendering in React? May 3 How does @extend rule work in SCSS (Sass)? May 2 How different is Handling Events in React vs HTML DOM? May 2 How to create bouncing balls using HTML canvas and JavaScript? Apr 30 HTML canvas methods

You might also like these

How to remove special characters (dash, asterisk etc) from any string in PHP?PHPAmpersand (Parent Selector) in SCSS (Sass)SCSSKilling A Project Part 1: What criteria should be used to cancel/kill a project?MiscHow to add today’s date in HTML input date value using JavaScript?JavaScriptObservation of Human Behavior [Shopping Observation Example]MiscThe :last-of-type selectorCSSWhat’s new in WordPress 5.5?WordPressHow to avoid element shift on border change while hovering in CSS?CSSPostgreSQL transactions using the BEGIN, COMMIT, and ROLLBACK statements.PostgresWhat is Prototypal Inheritance in JavaScript?JavaScriptThe Difference Between isNaN() Method And isNaN() Function In JavaScriptJavaScriptHow to make HTML form interactive and using CSS?CSS