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 7683945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:54:44+00:00 2026-05-31T18:54:44+00:00

How do you replace a NULL value in the select with an empty string?

  • 0

How do you replace a NULL value in the select with an empty string?
It doesn’t look very professional to output "NULL" values.

This is very unusual and based on my syntax I would expect it to work.
I’m hoping for an explanation why it doesn’t.

select CASE prereq WHEN (prereq IS NULL) THEN " " ELSE prereq end from test;

Example of what the original table looks like, what I want, and what actually prints:

original     wanted      what actually prints
--------     ------      ---------------------
value1       value1      
NULL                     NULL
value2       value2      
NULL                     NULL

As you can see it does the opposite of what I want, hence I tried flipping the IS NULL to IS NOT NULL and of course that didn’t fix it. I also tried swapping the position of when case, which did not work.

It seems the 3 solutions given below all do the task.

select if(prereq IS NULL ," ",prereq ) from test
select IFNULL(prereq,"") from test
select coalesce(prereq, '') from test
  • 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-05-31T18:54:46+00:00Added an answer on May 31, 2026 at 6:54 pm

    Some of these built-in functions should work:

    COALESCE(value,…)

    Returns the first non-NULL value in the list, or NULL if there are no non-NULL values.

    IS NULL

    Tests whether a value is NULL.

    IFNULL(expr1,expr2)

    If expr1 is not NULL, IFNULL() returns expr1; otherwise it returns expr2.

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

Sidebar

Related Questions

;WITH Companies(pkCompanyID,name,parentCompanyID,SomeId) AS ( SELECT tblCompany.pkCompanyID, tblCompany.name, NULL,--this is a int with no value
Does anyone nows how to replace null values with another column in another table
Ive got table with null values in it. I would like to copy this
Hi i need to replace value into null value in plpython, but how can
I use squirrel 3.2.0 When I try to replace this trigger: CREATE OR REPLACE
I've got a query: SELECT taskDeadline, subtasksDeadline, REPLACE( LEAST( COALESCE(t.deadline, 2147483647), COALESCE(sub.deadline, 2147483647) ),
insert into PendingEmails (Subject,Body,ToEmail,PendingEmailStatusID) select REPLACE( select subject from dbo.EmailTemplates where ID = 7
I have a string that contains multiple parameters delimited by #, like this :
I'm receiving the following error on this line of code select.up().appendChild(sw); With error SCRIPT438:
var doc = w.document; doc.open('application/CSV','replace'); doc.charset = utf-8; doc.write(all,hello); doc.close(); if(doc.execCommand(SaveAs,null,file.csv)) { window.alert(saved );

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.