MySQL If Statement With IS NULL Example

Jan 08, 2022

.

Admin

Hello Friends,

This article will give you example of MySQL if statement with is null. I explained simply about MySQL if statement with is null. This tutorial will give you simply example of MySQL if statement with is null.

In this post, You'll learn use how to use if statement with is null in MySQL. i will show you use of if statement with is null in SQL query.

Here i will give you many example for MySQL if statement with is null.

Table: user_payments


So, let's see bellow solution:

Solution SQL Query:

SELECT

id,

user_id,

CASE WHEN charge IS NULL

THEN 0

ELSE charge

END as charge,

payment_date

FROM `user_payments`

Output:

It will help you...

#MySQL