MySQL If Statement With IS NOT NULL Example
Hello Friends,
This article will give you example of MySQL if statement with is not null. I explained simply about MySQL if statement with is not null in SQL query. This tutorial will give you example of MySQL if statement with is not null.
In this post, You'll learn use how to use if statement with is not null in MySQL. i will show you use of if statement with is not null in MySQL.
Here i will give you many example for MySQL if statement with is not null.
Table: user_payments
So, let's see bellow solution:
Solution SQL Query:
SELECT
id,
user_id,
CASE WHEN charge IS NOT NULL
THEN charge
ELSE 0
END as charge,
payment_date
FROM `user_payments`
Output:
It will help you...
- How to Increase max_connections in MySQL?
- How to Install the PHP PDO MySQL Extension on Ubuntu 22.04?
- How to Install PHP MySQL on Linux Ubuntu?
- How to Install LEMP Stack Nginx, MySQL, PHP on Ubuntu?
- How to Change MySQL Root User Password Ubuntu?
- PHP 8 MySQL Form Validation Example
- How to Select First Row Only in PHP MySQL?
- How To Backup MySQL Database Using PHP Example