No. | Title |
---|---|
1 | Explanation |
2 | Coding Example |
3 | Conclusion |
b) Dealing with NULL values in SELECT statements:
c) Handling NULL values in WHERE clauses:
d) Handling NULL values in aggregate functions:
SELECT Name
FROM Employees
WHERE Salary IS NOT NULL;
a) Here’s an example of updating NULL values in the “Salary” column to a default value of 0:
UPDATE Employees
SET Salary = 0
WHERE Salary IS NULL;
INSERT INTO Customers (Name, Address)
VALUES ('John Doe', NULL);
UPDATE Products
SET Price = 10
WHERE Price IS NULL;
SELECT OrderID, Quantity, UnitPrice,
COALESCE(Quantity, 0) * UnitPrice AS TotalCost
FROM Orders;