Preamble

In this article, you will learn how to display NULL values in other meaningful values.
Dr.EFCodd, who is the creator of the relational model for the database, introduced this concept of NULL in the theory of relational databases.
According to Dr.EFCodd, NULL means unknown value or missing information.
MySQL also supports NULL, which represents the concept of missing or inapplicable information.
In the database table, you store data that contain NULL values
When you provide data to users in the form of reports, it makes no sense to show NULL values.
To make reports more readable and understandable, you need to display NULL values in the form of other values, such as unknown, missing, or inaccessible (no data). You can do this by using the IF function.
The syntax of the IF function is as follows:
IF(exp,exp_result1,exp_result2);
If the value of exp is TRUE (when exp <> 0 and exp <> NULL), then IF returns a value from otherwise exp_result1 returns exp_result2.
The IF return can be a string or a number, depending on exp_result1 and exp_result2.
Lets practice with some examples for a better understanding
Below is the partial data in the customer table, which includes the customername state and country:
SELECT
customername, state, country
FROM
ORDER BY country;
Status values are not available for some clients. You can use the IF function to display the NULL value as N/A:
SELECT
customername, IF(state IS NULL, 'N/A', state) state, country
FROM
ORDER BY country;
In addition to the IF function, MySQL provides the IFNULL function, which allows NULL to process values directly. The syntax of the IFNULL function is given below:
IFNULL(exp,exp_result);
The IFNULL function returns the value of the expression exp_result if exp is calculated as NULL, otherwise, it returns the value of exp.
In the next query, the IFNULL function displays NULL as unknown as follows:
SELECT customername,
IFNULL(state, "N/A")state,
country
FROM customers
ORDER BY country;
In this article, you learned how to use IF and IFNULL to display NULL values on other more important values to present data in a readable form.
Important concepts on NULL values
Enteros
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
Driving Smarter Growth with Enteros: AI Performance Management and Forecasting Models for Accurate Cost Estimation and Operational Excellence
- 23 October 2025
- Database Performance Management
Introduction In an era defined by rapid digital transformation, organizations across industries face the dual challenge of accelerating growth while maintaining cost efficiency. Traditional IT management and forecasting techniques are no longer sufficient to handle the scale, complexity, and dynamic workloads of modern data ecosystems. Businesses require intelligent systems that can not only manage database … Continue reading “Driving Smarter Growth with Enteros: AI Performance Management and Forecasting Models for Accurate Cost Estimation and Operational Excellence”
Transforming Fashion Operations with Enteros: Database Performance Management Meets Cloud FinOps Efficiency
Introduction The fashion industry is undergoing a digital renaissance — one where data, technology, and artificial intelligence intersect to redefine how brands operate, forecast, and engage customers. With the rapid expansion of online retail, omnichannel experiences, and global supply chains, fashion enterprises face increasing challenges in managing vast amounts of data across diverse systems. In … Continue reading “Transforming Fashion Operations with Enteros: Database Performance Management Meets Cloud FinOps Efficiency”
Optimizing Cloud Formation and Storage Efficiency in Technology with Enteros: AIOps and FinOps in Action
- 22 October 2025
- Database Performance Management
Introduction The technology sector is undergoing a cloud revolution. Every enterprise — from SaaS startups to global tech giants — is shifting workloads to the cloud to gain agility, scalability, and cost efficiency. However, as cloud infrastructures expand, managing and optimizing their performance becomes increasingly complex. Cloud Formation, Storage Buckets, and multi-cloud architectures have unlocked … Continue reading “Optimizing Cloud Formation and Storage Efficiency in Technology with Enteros: AIOps and FinOps in Action”
Forecasting Cost and Boosting RevOps Efficiency in Insurance with Enteros: AI SQL and Intelligent Resource Group Management
Introduction The insurance industry is at a pivotal moment. As data complexity surges and digital transformation accelerates, insurers are under immense pressure to manage operational costs, improve forecasting accuracy, and optimize their revenue operations (RevOps) efficiently. Traditional systems—burdened with siloed data, limited visibility, and reactive performance monitoring—can no longer keep up with modern scalability and … Continue reading “Forecasting Cost and Boosting RevOps Efficiency in Insurance with Enteros: AI SQL and Intelligent Resource Group Management”