From 327dc94f061428037f4afd299bfd329b4db4e5c3 Mon Sep 17 00:00:00 2001 From: AdityaTharunJ Date: Mon, 25 May 2026 12:11:55 +0530 Subject: [PATCH] Fix SQL queries for null value handling Updated SQL queries to handle null values correctly using COALESCE and IS NULL. --- SQL Deep Dive/3 Valued Logic Exercises/questions.sql | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/SQL Deep Dive/3 Valued Logic Exercises/questions.sql b/SQL Deep Dive/3 Valued Logic Exercises/questions.sql index 99a02d4..c6c5128 100644 --- a/SQL Deep Dive/3 Valued Logic Exercises/questions.sql +++ b/SQL Deep Dive/3 Valued Logic Exercises/questions.sql @@ -4,9 +4,8 @@ * Table: customers * Question: adjust the following query to display the null values as "No Address" */ -SELECT address2 -FROM customers - +SELECT coalesce(address2, 'No Address') +FROM customers; /* * DB: Store * Table: customers @@ -15,7 +14,7 @@ FROM customers SELECT * FROM customers -WHERE COALESCE(address2, null) IS NOT null; +WHERE address2 IS NOT null; /* * DB: Store @@ -24,4 +23,4 @@ WHERE COALESCE(address2, null) IS NOT null; */ SELECT coalesce(lastName, 'Empty'), * from customers -where (age = null); +where (age is null);