
Answer-first summary for fast verification
Answer: UPDATE Transactions SET TransactionAmount = 0 WHERE TransactionAmount IS NULL;
The correct query is option B, which updates the missing values in the 'TransactionAmount' field to 0. This ensures that the dataset remains consistent and accurate by handling the missing values appropriately.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
You are working on a data cleansing project where you need to handle missing values in a dataset of customer transactions. The dataset is stored in Azure SQL Database and includes fields such as 'TransactionID', 'CustomerID', 'TransactionAmount', and 'TransactionDate'. Which SQL query would you use to identify and handle missing values, ensuring that the dataset remains consistent and accurate?
A
DELETE FROM Transactions WHERE TransactionAmount IS NULL;
B
UPDATE Transactions SET TransactionAmount = 0 WHERE TransactionAmount IS NULL;
C
SELECT * FROM Transactions WHERE TransactionAmount IS NOT NULL;
D
SELECT ISNULL(TransactionAmount, 0) AS TransactionAmount FROM Transactions;
No comments yet.