logo
  • Home
  • Contact
💵
Should I be buying I-Bonds in 2023?
💰
Need a step-by-step guide to opening your Roth IRA?
Buy me a coffee Buy me a coffee
aws c++ career cli css docker finance git java js misc python sql

How to Check if a Column is Null in MySQL


Suppose we want to write a SQL query that checks if a column is NULL in MySQL.

We can write this condition using IS NULL and IS NOT NULL.

SELECT * FROM table_name
WHERE col_name IS NULL;

Empty strings are not considered null in MySQL, but if we want them to be included in our check, we can add that very easily.

SELECT * FROM table_name
WHERE col_name IS NULL OR col_name = '';

Related in SQL

How to Group By Alias in an AWS Athena SQL Query
How to Group Rows Into Buckets with Count in a SQL Query
How to Get the Average String Length of a Column in MySQL
How to Check If Value Exists in a MySQL Table
How to Query a Table Using MySQL CLI
How to Get All Keys in JSON Object from MySQL
How to Query JSON Objects in MySQL
How to Match Columns that Contain a Substring in SQL
How to Set Up a Free PostgreSQL Database on Heroku
How to Change the Primary Key to Another Column in SQL Server
How to Modify Table to Use Composite Primary Key in MySQL
How to Format a Number with Two Decimal Places in SQLite
How to Order By Multiple Columns in SQL
How to Count the Number of Rows with the Same Value
How to Order a SQL String Column By Its Numeric Value
© , LogFetch   âˆ™   Advertise Here   âˆ™   Privacy Policy