How do you find records where phone is not provided (NULL) in customers?

Study for the SQL Basics Test. Improve your knowledge with multiple choice questions and detailed explanations. Prepare effectively to master SQL concepts!

Multiple Choice

How do you find records where phone is not provided (NULL) in customers?

Explanation:
Null values represent missing or unknown data, so you can’t use the equals operator to test them. To find records where the phone field has no value, you must check for NULL with IS NULL. This condition is true only for rows where phone has no entry. Using IS NOT NULL would return rows where a phone number exists, not the missing ones. The approach using = NULL isn’t valid in SQL and will not match any rows. So the correct query is: SELECT * FROM customers WHERE phone IS NULL;

Null values represent missing or unknown data, so you can’t use the equals operator to test them. To find records where the phone field has no value, you must check for NULL with IS NULL. This condition is true only for rows where phone has no entry. Using IS NOT NULL would return rows where a phone number exists, not the missing ones. The approach using = NULL isn’t valid in SQL and will not match any rows. So the correct query is: SELECT * FROM customers WHERE phone IS NULL;

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy