Ø DDL (Data Definition Language)
Create, alter, drop
Ø DML (Data Manipulation Language)
Insert, update, select & delete
Ø DCL (Data Control Language)
Grant, Revoke
Ø TCL (Transaction Control Language)
Commit, Rollback
Static insertion: Insert into cust(cno, cname, cloc) values (10, “xyz”, “hyd”)
Dynamic insertion: Insert into cust(cno, cname, cloc) values (v1, v2, v3)
v1,v2, v3 are host variables to be defined in working storage section.
Delete from cust
Delete from cust where cno = 20
Update cust set cname = “ xyz” where cno = 20
Select cno,cname from cust
Select * from cust
Select * from, cust where cno = v1
Select * from cust wehre cno=v1 and cname =v2
Select * from cust where cno between 20 and 60
Select * from cust where cname like “%y%”
Column functions:
Select max(sal) from emp
Select min(sal) from emp
Select avg(sal) from emp
Select sum(sal) from emp
To avoid duplicate rows : select distinct cno,cname from cust
To get total no. of rows : select count(*) from cust
thank you........
ReplyDelete