There was an error while loading. Please reload this page.
1 parent 758b53c commit fa81a48Copy full SHA for fa81a48
default_integrity_constraint.sql
@@ -0,0 +1,15 @@
1
+use temp_db;
2
+
3
+show tables;
4
5
6
+-- this is basically used when there is no value provided for a column and we want to have some default value instead of null
7
8
+create table emp_new3(id int, exp int default 1);
9
10
+insert into emp_new3 values(1, 1); -- no error
11
+insert into emp_new3 values(NULL, NULL); -- no error
12
13
+insert into emp_new3(id) values(1); -- no error but the default value of exp is 1 not NULL.
14
15
+select * from emp_new3;
0 commit comments