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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:35:04+00:00 2026-05-25T23:35:04+00:00

I wrote out this Mysql query, but return a lot of blank fields for

  • 0

I wrote out this Mysql query, but return a lot of blank fields for the customers_telephone table
since it was never a required field. I would like to return some dummy data on my
query (without inserting it into the database) if the field is NULL. I know MySQL
uses if clauses but I think it’s only for creating databases or … ?

here’s my stamp

SELECT orders.orders_id AS recipient_id, delivery_company, delivery_street_address, delivery_city, delivery_postcode, delivery_state, delivery_country, customers_telephone
FROM orders, orders_products
WHERE orders.orders_id = orders_products.orders_id
AND products_id = 416
ORDER BY `orders`.`orders_id` DESC

UPDATE

I tried doing this, but it still is not working, maybe I did it in the wrong place?

SELECT orders.orders_id AS recipient_id, delivery_company, delivery_street_address, delivery_city,  delivery_postcode, delivery_state, delivery_country, IFNULL(customers_telephone, 'no number') AS customers_number
FROM orders, orders_products
WHERE orders.orders_id = orders_products.orders_id
AND products_id = 416
ORDER BY `orders`.`orders_id` DESC

Returns

recipient_id    delivery_company    delivery_street_address     delivery_city       delivery_postcode   delivery_state  delivery_country    number
191743          This Chick Bakes    31-31 48th Ave #B           Long Island City    11101               NY              United States       917.848.6437
191724                              44 Miraflores Ave (studio)  San Rafael          94901               CA              United States    
191723                              397 South River Street      Wilkes-Barre        18702               PA              United States    
  • 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-25T23:35:05+00:00Added an answer on May 25, 2026 at 11:35 pm

    Use the IFNULL function to provide a value if the field is NULL:

    IFNULL(customers_telephone, 'dummydata') AS customers_telephone
    

    IFNULL is a non-standard MySQL extension. The standard way is to use the COALESCE function for this purpose. COALESCE is also supported by MySQL, but it is slightly slower than IFNULL, though it probably won’t matter here.

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

Sidebar

Related Questions

I wrote this code for zoom in/out . it works but even with one
So my expertise is not in MySQL so I wrote this query and it
I wrote this code for zoom in / out and it suppesed to only
I recently found out about C# extension methods and wrote this one: /// <summary>
I wrote an implementation of inversion-counting. This is an assignment being carried out in
I wrote a small app that turns out to be using a lot of
Hi i'm struggling to write a particular MySQL Join Query. I have a table
Sorry because this is a noob question. I'm new with MySQL: I wrote a
This is currently my MySQL UPDATE query, which is called from program written in
I thought I could figure this out on my own, but apparently I am

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.