Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8295959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:47:39+00:00 2026-06-08T14:47:39+00:00

How to write a case in mysql query which checks for null or 0

  • 0

How to write a case in mysql query which checks for null or 0 for a particular column


CREATE TABLE tblConfirmationStatus (Confirm_Status TINY INT)

INSERT INTO tblConfirmationStatus 
Confirm_Status
VALUES
(1),
(0),
(1),
({null}),
(0),
(1),
({null})

Required Output

ConfirmStatus

   Confirmed
   Not Confirmed
   Confirmed
   Not Confirmed
   Not Confirmed
   Confirmed
   Not Confirmed

0 or Null – Not Confirmed, 1-Confirmed

SELECT CASE Confirm_Status 
            WHEN NULL OR 0 THEN 'Not Confirmed' 
             ELSE  'Confirmed' END AS ConfirmStatus
  FROM tblConfirmationStatus;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T14:47:40+00:00Added an answer on June 8, 2026 at 2:47 pm

    There’s two options for CASE statements – the one you posted, or:

    SELECT CASE 
            WHEN Confirm_Status IS NULL OR Confirm_Status = 0 THEN 'Not Confirmed' 
            ELSE  'Confirmed' 
           END AS ConfirmStatus
    

    But you could probably use:

    SELECT CASE 
            WHEN Confirm_Status > 0 THEN 'Confirmed' 
            ELSE  'Not Confirmed' 
           END AS ConfirmStatus
    

    NULL is the absence of a value, so checking for values above zero should fall into the same category as zero.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a case statement in mysql which checks if a person
I have a MySQL query that looks like this: UPDATE `Table` SET `Column` =
I am using MySQL Connector/Net and I want to write a query against a
BACKGROUND I'm trying to write a function query query('type', 'parameters', 'bind_types') which I can
I need to write a case statement that will return 1 of 3 if
Can someone help me understand how to write this case statement properly its not
What is the difference between sequential write and random write in case of :-
I am trying to write a test case for the depot application. Below is
I have to write integration test case for my one feature listing page and
I'm just wondering if there is a best case to write this code: $('#set_duration_30').click(function(event)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.