replace null with 0 in sql
SELECT IFNULL(Price, 0) FROM Products;
SELECT COALESCE(Price, 0) FROM Products;
-- Oracle (extra):
SELECT NVL(Price, 0) FROM Products;
replace null with 0 in sql
SELECT IFNULL(Price, 0) FROM Products;
SELECT COALESCE(Price, 0) FROM Products;
-- Oracle (extra):
SELECT NVL(Price, 0) FROM Products;
replace null in sql
CASE WHEN ColumnName IS NULL THEN 'anyText'
ELSE ColumnName END
---------EXAMPLE --------------------------
SELECT E.Name as Employee, CASE WHEN M.Name IS NULL THEN 'No Manager'
ELSE M.Name END as Manager
FROM tblEmployee E
LEFT JOIN tblEmployee M
ON E.ManagerID = M.EmployeeID
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us