Preamble
PostgreSQL IS NULL condition is used to check the value of NULL in SELECT, INSERT, UPDATE or DELETE operators.
PostgreSQL IS NULL condition
IS expression NULL
Parameters and arguments
- expression – A value to check if it is a NULL value.
Note:
- If the expression is NULL, the condition is evaluated as TRUE.
- If the expression is not a value of NULL, the condition is evaluated as FALSE.
Example of an IS NULL condition with the SELECT operator
Let’s consider an example of using PostgreSQL IS NULL in the SELECT operator:
SELECT *
FROM empls
WHERE first_number IS NULL;
This example of PostgreSQL IS NULL will return all records from the employee table where first_name contains the value NULL.
Example of a condition with the INSERT operator
Then let’s consider an example of using PostgreSQL IS NULL in the INSERT operator:
INSERT INTO contacts
(first_name, last_name)
SELECT first_name, last_name
FROM empls
WHERE empl_number IS NULL;
This example of PostgreSQL IS NULL will insert records into the contacts table where employee_number contains the value NULL.
Example of a condition with UPDATE operator
Next Let’s consider an example of using PostgreSQL IS NULL in UPDATE operator:
UPDATE empls
SET status = 'Not Active'
WHERE last_name IS NULL;
This example of PostgreSQL IS NULL will update records in the employee table where last_name contains the value NULL.
Example of a condition with the DELETE operator
Next Let’s consider an example of using PostgreSQL IS NULL in DELETE operator:
DELETE FROM empls
WHERE empl_number IS NULL;
This example of PostgreSQL IS NULL will remove all records from the contacts table where employee_number contains the value NULL.
PostgreSQL: Coalesce | Course
About Enteros
IT organizations routinely spend days and weeks troubleshooting production database performance issues across multitudes of critical business systems. Fast and reliable resolution of database performance problems by Enteros enables businesses to generate and save millions of direct revenue, minimize waste of employees’ productivity, reduce the number of licenses, servers, and cloud resources and maximize the productivity of the application, database, and IT operations teams.
The views expressed on this blog are those of the author and do not necessarily reflect the opinions of Enteros Inc. This blog may contain links to the content of third-party sites. By providing such links, Enteros Inc. does not adopt, guarantee, approve, or endorse the information, views, or products available on such sites.
Are you interested in writing for Enteros’ Blog? Please send us a pitch!
RELATED POSTS
Revolutionizing Healthcare IT: Leveraging Enteros, FinOps, and DevOps Tools for Superior Database Software Management
- 21 November 2024
- Database Performance Management
In the fast-evolving world of finance, where banking and insurance sectors rely on massive data streams for real-time decisions, efficient anomaly man…
Optimizing Real Estate Operations with Enteros: Harnessing Azure Resource Groups and Advanced Database Software
In the fast-evolving world of finance, where banking and insurance sectors rely on massive data streams for real-time decisions, efficient anomaly man…
Revolutionizing Real Estate: Enhancing Database Performance and Cost Efficiency with Enteros and Cloud FinOps
In the fast-evolving world of finance, where banking and insurance sectors rely on massive data streams for real-time decisions, efficient anomaly man…
Enteros in Education: Leveraging AIOps for Advanced Anomaly Management and Optimized Learning Environments
In the fast-evolving world of finance, where banking and insurance sectors rely on massive data streams for real-time decisions, efficient anomaly man…