Top community members
All Questions Ask Question

Welcome to Dirask IT community! ❤ 💻
We are community that shares solutions with each other.

If you think you have something to add here.

you are welcome with your fresh ideas - List Articles

MySQL - select only rows where removal_time is NULL

1 answers
3 points

How to select only rows where removal_time is NULL with MySQL?

Doesn't work:

SELECT * FROM qa_post_comments WHERE removal_time = NULL;

It can be executed, but it doens't return any values at all - NULL or NOT NULL.
How to make it work?

 

1 answers
1 points

Correct SQL:

SELECT * FROM qa_post_comments WHERE removal_time IS NULL

Where we want to select rows with only NULL values:

IS NULL

And if we want to select rows with NOT NULL values:

IS NOT NULL

Eg:

SELECT * FROM qa_post_comments WHERE removal_time IS NOT NULL

Is is very common mistake and a lot of people try to use:

  • = NULL
  • != NULL
0 comments Add comment

Checkout latest Findings & News:

Checkout latest questions:

Checkout latest wiki articles:

Hey 👋
Would you like to know what we do?
  • Dirask is IT community, where we share coding knowledge and help each other to solve coding problems.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.
Read more