Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (55.6k points)

Can anyone explain how to replace NULL values with ‘0’ in SQL?

2 Answers

0 votes
by (119k points)

In SQL, you can use ISNULL () function to replace the NULL values with any value. Here is the syntax for replacing NULL values with zero:

SELECT ISNULL (Column_name , 0 )

FROM Table_Name;

You can also use COALESCE() function to replace NULL values and the following is the syntax for that:

SELECT COALESCE (Column_name , 0 )

FROM Table_Name;

If you want to take a course that can provide Instructor-led training and certification then sign up for this SQL Certification program by Intellipaat.

0 votes
ago by (3.1k points)

If you want to replace the null values with 0, you can use the ISNULL function. For better understanding here is the simple approach.

SELECT ISNULL(column_name, '0') AS ColumnName

FROM TableName;

Related questions

0 votes
2 answers
asked May 3, 2020 in SQL by Sudhir_1997 (55.6k points)
0 votes
1 answer
0 votes
1 answer
asked Jul 19, 2019 in SQL by Tech4ever (20.3k points)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...