There was an error while loading. Please reload this page.
1 parent 81e9cbd commit b96b8d7Copy full SHA for b96b8d7
ifNULL function.sql
@@ -0,0 +1,18 @@
1
+use temp_db;
2
+
3
+show tables;
4
5
+create table emp_3(id int, salary int);
6
7
+insert into emp_3 values(1, 10000);
8
+insert into emp_3 values(2, 14253);
9
+insert into emp_3 values(NULL, 1000);
10
+insert into emp_3 values(4, NULL);
11
12
+select * from emp_3;
13
14
+-- if we add the value in the NULL
15
16
+select (salary + 20000) from emp_3; -- here null + 20000 is NULL
17
18
+select (ifNULL(salary, 0) + 10) from emp_3; -- now it will show 10 where ever is NULL value
0 commit comments