
Answer-first summary for fast verification
Answer: Use the COALESCE function for handling null values.
The COALESCE function returns the first non-null expression among its arguments. For example, you can use COALESCE(OrderID, 0) to ensure that if OrderID is null, the query returns 0 instead. This is a common technique to handle null values in T-SQL queries.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
In your Fabric data warehouse, there is a table named Sales.Orders which includes the columns: OrderID, CustomerID, OrderDate, and TotalAmount. You are required to write a T-SQL query to fetch all these columns, while ensuring that any null values are replaced with suitable default values. How would you complete the code? To answer, select the appropriate options in the answer area. NOTE: Each correct selection is worth one point.
A
Use the COALESCE function for handling null values.
B
Use the ISNULL function for handling null values.
C
Use the LEAST function for determining the smallest value.
D
Use the CASE statement for handling null values.
No comments yet.