There was an error while loading. Please reload this page.
1 parent 46b0694 commit 02d149aCopy full SHA for 02d149a
integrity_constraint.sql
@@ -0,0 +1,22 @@
1
+use temp_db;
2
+
3
+show tables;
4
5
+/* different types of integrity constraint
6
+1. NOT NULL
7
+ 2. UNIQUE
8
+ 3. PRIMARY KEY
9
+ 4. FOREIGN KEY
10
+ 5. CHECK
11
+ 6. DEFAULT
12
13
+ these are applied on table column
14
+ at the time of creating the table and altering the table
15
+*/
16
17
+-- example using NOT NULL means we can not be having any NULL values in the table
18
+create table emp_new(s_no int NOT NULL, s_name varchar(15)); -- here s_no can not be null
19
20
+insert into emp_new values(1, 'SANOJ'); -- successfully inserted
21
+insert into emp_new values (NULL, 'Kumar'); -- it will return error that s_no cannot be null
22
+insert into emp_new(s_name) values ('Kumar'); -- it will also return error same error
0 commit comments