Skip to content

Commit da19fe9

Browse files
committed
All Manipulation Query.
1 parent d39061d commit da19fe9

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

15. DML Complete.sql

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
-- INSERT
2+
insert into Student(Roll,Fname,Lname,Class) values(1,"Nikhil","Patel","Final Year");
3+
insert into Student Values(2,"Brahmeshwar","Thakur","Final Year");
4+
5+
-----------------------------------------
6+
-- UPDATE
7+
update Student SET Roll = 31 where fname="Nikhil";
8+
--( to update multiple rows)
9+
update Student set Roll = Roll + 1;
10+
11+
-- to support Referntial Integrity.
12+
ON UPDATE CASCADE;
13+
14+
15+
-- Can be added to the table while creating constraints. Suppose there is a situation where we have two tables
16+
--such that primary key of one table is the foreign key for another table. if we update the primary key of the first
17+
-- table then using the ON UPDATE CASCADE foreign key of the second table automatically get updated.
18+
-----------------------------------------
19+
20+
-- DELETE
21+
22+
-- delete the row of roll 45
23+
delete from Student where Roll=45;
24+
25+
-- delete all rows
26+
delete from Student;
27+
28+
-- to support Referential Integrity.
29+
foreign key (Cust_ID) REFERENCE Student(Stud_ID) ON DELETE SET NULL;
30+
31+
-------------------
32+
33+
-- REPLACE (primarily use for always present tuples)
34+
35+

0 commit comments

Comments
 (0)