nadar saraswathi college of engineering &...
TRANSCRIPT
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
NADAR SARASWATHI COLLEGE OF
ENGINEERING & TECHNOLOGY
Vadapudhupatti-Theni- 625531
Laboratory Manual
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
III SEMESTER / II YEAR
CS6312: DATABASE MANAGEMENT SYSTEMS
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
CS6312-DBMS Lab
LIST OF EXPERIMENTS
1. Creation of a database and writing SQL queries to retrieve information from the database.
2. Performing Insertion, Deletion, Modifying, Altering, Updating and Viewing records based on
conditions.
3. Creation of Views, Synonyms, Sequence, Indexes, Save point.
4. Creating an Employee database to set various constraints.
5. Creating relationship between the databases.
6. Study of PL/SQL block.
7. Write a PL/SQL block to satisfy some conditions by accepting input from the user.
8. Write a PL/SQL block that handles all types of exceptions.
9. Creation of Procedures.
10. Creation of database triggers and functions
11. Mini project (Application Development using Oracle/ Mysql )
a) Inventory Control System.
b) Material Requirement Processing.
c) Hospital Management System.
d) Railway Reservation System.
e) Personal Information System.
f) Web Based User Identification System.
g) Timetable Management System.
h) Hotel Management System
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
BASIC DDL COMMANDS
SQL> create table harishstudent(s_name char(15),rno integer,mark1 integer,mark2 integer,mark3
integer);
Table created.
SQL> desc harishstudent;
Name Null? Type
----------------------------------------- -------- ----------------------
S_NAME CHAR(15)
RNO NUMBER(38)
MARK1 NUMBER(38)
MARK2 NUMBER(38)
MARK3 NUMBER(38)
SQL> alter table harishstudent add(total integer);
Table altered.
SQL> desc harishstudent;
Name Null? Type
----------------------------------------- -------- ----------------------
S_NAME CHAR(15)
RNO NUMBER(38)
MARK1 NUMBER(38)
MARK2 NUMBER(38)
MARK3 NUMBER(38)
TOTAL NUMBER(38)
SQL> alter table harishstudent modify(rno varchar2(4));
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
Table altered.
SQL> desc harishstudent;
Name Null? Type
----------------------------------------- -------- ----------------------
S_NAME CHAR(15)
RNO VARCHAR2(4)
MARK1 NUMBER(38)
MARK2 NUMBER(38)
MARK3 NUMBER(38)
TOTAL NUMBER(38)
SQL> alter table harishstudent drop(rno);
Table altered.
SQL> desc harishstudent;
Name Null? Type
----------------------------------------- -------- ----------------------
S_NAME CHAR(15)
MARK1 NUMBER(38)
MARK2 NUMBER(38)
MARK3 NUMBER(38)
TOTAL NUMBER(38)
SQL> insert into harishstudent values('Hari',78,89,90,257);
1 row created.
SQL> insert into harishstudent values('Jamaai',56,67,78,201);
1 row created.
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
SQL> insert into harishstudent values('Dober',65,54,43,162);
1 row created.
SQL> select*from harishstudent;
S_NAME MARK1 MARK2 MARK3 TOTAL
--------------- ---------- ---------- ---------- ----------
Hari 78 89 90 257
Jamaai 56 67 78 201
Dober 65 54 43 162
SQL> delete from harishstudent;
3 rows deleted.
SQL> drop table harishstudent;
Table dropped.
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
BASIC DML COMMANDS
SQL> create table harishclient(c_no varchar2(3),c_name varchar2(10), address varchar2(20),city
varchar2(15),state varchar2(5),bal_due number(10,2));
Table created.
SQL> desc harishclient;
Name Null? Type
----------------------------------------- -------- ----------------------
C_NO VARCHAR2(3)
C_NAME VARCHAR2(10)
ADDRESS VARCHAR2(20)
CITY VARCHAR2(15)
STATE VARCHAR2(5)
BAL_DUE NUMBER(10,2)
SQL> insert into harishclient values('101','Hari','5roads','salem','tn',2500);
1 row created.
SQL> insert into harishclient values('102','Harish','bazaar st','chsm','tn',1000);
1 row created.
SQL> insert into harishclient values('103','Jamaai','deevattipatty','salem','tn',0);
1 row created.
SQL> insert into harishclient values('104','Dober','leebazaar','salem','tn',400);
1 row created.
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
SQL> insert into harishclient values('105','Mathan','deevattipatty','hosur','tn',4000);
1 row created.
SQL> select*from harishclient;
C_N C_NAME ADDRESS CITY STATE BAL_DUE
--- ---------- -------------------- --------------- ----- ----------
101 Hari 5roads salem tn 2500
102 Harish bazaar st chsm tn 1000
103 Jamaai deevattipatty salem tn 0
104 Dober leebazaar salem tn 400
105 Mathan deevattipatty hosur tn 4000
SQL> create table harishproduct(pr_no varchar2(3),description varchar2(15),qty_bal
number(8),profit number(4,2),pur_Rs number(8,2),sell_Rs number(8,2));
Table created.
SQL> desc harishproduct
Name Null? Type
----------------------------------------- -------- ----------------------
PR_NO VARCHAR2(3)
DESCRIPTION VARCHAR2(15)
QTY_BAL NUMBER(8)
PROFIT NUMBER(4,2)
PUR_RS NUMBER(8,2)
SELL_RS NUMBER(8,2)
SQL> insert into harishproduct values('551','JamaaiIceCream',1000,50.8,5.25,12.5);
1 row created.
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
SQL> delete from harishproduct where description='JamaaiIceCream';
1 row deleted.
SQL> insert into harishproduct values('551','chocobar',1000,50.8,5.25,12.5);
1 row created.
SQL> insert into harishproduct values('551','vennila',250,28.9,2.12,5.0);
1 row created.
SQL> insert into harishproduct values('553','cone',1000,50.8,5.25,12.5);
1 row created.
SQL> insert into harishproduct values('554','mango',590,45,5.65,10);
1 row created.
SQL> select*from harishproduct;
PR_ DESCRIPTION QTY_BAL PROFIT PUR_RS SELL_RS
--- --------------- ---------- ---------- ---------- ----------
551 chocobar 1000 50.8 5.25 12.5
551 vennila 250 28.9 2.12 5
553 cone 1000 50.8 5.25 12.5
554 mango 590 45 5.65 10
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
SQL> select c_name from harishclient;
C_NAME
----------
Hari
Harish
Jamaai
Dober
Mathan
SQL> select*from harishclient where city='salem';
C_N C_NAME ADDRESS CITY STATE BAL_DUE
--- ---------- -------------------- --------------- ----- ----------
101 Hari 5roads salem tn 2500
103 Jamaai deevattipatty salem tn 0
104 Dober leebazaar salem tn 400
SQL> select c_name,city from harishclient where bal_due>=500;
C_NAME CITY
---------- ---------------
Hari salem
Harish chsm
Mathan hosur
SQL> select description from harishproduct;
DESCRIPTION
---------------
chocobar
vennila
cone
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
mango
SQL> select description,pr_no from harishproduct where pur_rs=5.25;
DESCRIPTION PR_
--------------- ---
chocobar 551
cone 553
SQL> select pr_no,qty_bal,profit,pur_rs,sell_rs from harishproduct;
PR_ QTY_BAL PROFIT PUR_RS SELL_RS
--- ---------- ---------- ---------- ----------
551 1000 50.8 5.25 12.5
551 250 28.9 2.12 5
553 1000 50.8 5.25 12.5
554 590 45 5.65 10
SQL> update harishclient set bal_due=0 where city='salem';
3 rows updated.
SQL> select*from harishclient;
C_N C_NAME ADDRESS CITY STATE BAL_DUE
--- ---------- -------------------- --------------- ----- ----------
101 Hari 5roads salem tn 0
102 Harish bazaar st chsm tn 1000
103 Jamaai deevattipatty salem tn 0
104 Dober leebazaar salem tn 0
105 Mathan deevattipatty hosur tn 4000
SQL> update harishproduct set sell_rs=2000,pur_rs=2000;
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
4 rows updated.
SQL> select*from harishproduct;
PR_ DESCRIPTION QTY_BAL PROFIT PUR_RS SELL_RS
--- --------------- ---------- ---------- ---------- ----------
551 chocobar 1000 50.8 2000 2000
551 vennila 250 28.9 2000 2000
553 cone 1000 50.8 2000 2000
554 mango 590 45 2000 2000
SQL> update harishclient set city='bombay' where c_no='101';
1 row updated.
SQL> select*from harishclient;
C_N C_NAME ADDRESS CITY STATE BAL_DUE
--- ---------- -------------------- --------------- ----- ----------
101 Hari 5roads bombay tn 0
102 Harish bazaar st chsm tn 1000
103 Jamaai deevattipatty salem tn 0
104 Dober leebazaar salem tn 0
105 Mathan deevattipatty hosur tn 4000
SQL> update harishproduct set QTY_BAL=25 where PROFIT>50;
2 rows updated.
SQL> select*from harishproduct;
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
PR_ DESCRIPTION QTY_BAL PROFIT PUR_RS SELL_RS
--- --------------- ---------- ---------- ---------- ----------
551 chocobar 25 50.8 2000 2000
551 vennila 250 28.9 2000 2000
553 cone 25 50.8 2000 2000
554 mango 590 45 2000 2000
SQL> update harishproduct set pur_rs=551 where pr_no='553';
1 row updated.
SQL> select*from harishproduct;
PR_ DESCRIPTION QTY_BAL PROFIT PUR_RS SELL_RS
--- --------------- ---------- ---------- ---------- ----------
551 chocobar 25 50.8 2000 2000
551 vennila 250 28.9 2000 2000
553 cone 25 50.8 551 2000
554 mango 590 45 2000 2000
SQL> delete from harishproduct where QTY_BAL=25;
2 rows deleted.
SQL> select*from harishproduct;
PR_ DESCRIPTION QTY_BAL PROFIT PUR_RS SELL_RS
--- --------------- ---------- ---------- ---------- ----------
551 vennila 250 28.9 2000 2000
554 mango 590 45 2000 2000
SQL> delete from harishclient where BAL_DUE<=1000;
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
4 rows deleted.
SQL> select*from harishclient;
C_N C_NAME ADDRESS CITY STATE BAL_DUE
--- ---------- -------------------- --------------- ----- ----------
105 Mathan deevattipatty hosur tn 4000
SQL> delete from harishproduct where PROFIT<30;
1 row deleted.
SQL> select*from harishproduct;
PR_ DESCRIPTION QTY_BAL PROFIT PUR_RS SELL_RS
--- --------------- ---------- ---------- ---------- ----------
554 mango 590 45 2000 2000
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
SQL-DML COMMANDS
SQL> create table harishbook(isbn number(6),title varchar2(10),author varchar2(10),qty
number(4),price number(5,2));
Table created.
SQL> desc harishbook;
Name Null? Type
----------------------------------------- -------- ----------------------
ISBN NUMBER(6)
TITLE VARCHAR2(10)
AUTHOR VARCHAR2(10)
QTY NUMBER(4)
PRICE NUMBER(5,2)
SQL> insert into harishbook values(1439,'UNIX','Balaguru',5,189);
1 row created.
SQL> insert into harishbook values(1857,'SEQA','Sommer',8,200);
1 row created.
SQL> insert into harishbook values(1264,'JAVA','Ritche',3,200);
1 row created.
SQL> insert into harishbook values(1476,'DBMS','Swamy',7,195);
1 row created.
SQL> insert into harishbook values(1643,'MPMC','Krishna',5,125);
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
1 row created.
SQL> select*from harishbook;
ISBN TITLE AUTHOR QTY PRICE
---------- ---------- ---------- ---------- ----------
1439 UNIX Balaguru 5 189
1857 SEQA Sommer 8 200
1264 JAVA Ritche 3 200
1476 DBMS Swamy 7 195
1643 MPMC Krishna 5 125
SQL> select*from harishbook where price=200;
ISBN TITLE AUTHOR QTY PRICE
---------- ---------- ---------- ---------- ----------
1857 SEQA Sommer 8 200
1264 JAVA Ritche 3 200
SQL> select*from harishbook where price between 175 and 250;
ISBN TITLE AUTHOR QTY PRICE
---------- ---------- ---------- ---------- ----------
1439 UNIX Balaguru 5 189
1857 SEQA Sommer 8 200
1264 JAVA Ritche 3 200
1476 DBMS Swamy 7 195
SQL> select*from harishbook where author like 'K%';
ISBN TITLE AUTHOR QTY PRICE
---------- ---------- ---------- ---------- ----------
1643 MPMC Krishna 5 125
SQL> select*from harishbook where author like '%y';
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
ISBN TITLE AUTHOR QTY PRICE
---------- ---------- ---------- ---------- ----------
1476 DBMS Swamy 7 195
SQL> update harishbook set price=price+2;
5 rows updated.
SQL> select*from harishbook;
ISBN TITLE AUTHOR QTY PRICE
---------- ---------- ---------- ---------- ----------
1439 UNIX Balaguru 5 191
1857 SEQA Sommer 8 202
1264 JAVA Ritche 3 202
1476 DBMS Swamy 7 197
1643 MPMC Krishna 5 127
SQL> update harishbook set qty=qty*2;
5 rows updated.
SQL> select*from harishbook;
ISBN TITLE AUTHOR QTY PRICE
---------- ---------- ---------- ---------- ----------
1439 UNIX Balaguru 10 191
1857 SEQA Sommer 16 202
1264 JAVA Ritche 6 202
1476 DBMS Swamy 14 197
1643 MPMC Krishna 10 127
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
SQL> select sqrt(price) from harishbook;
SQRT(PRICE)
-----------
13.820275
14.2126704
14.2126704
14.0356688
11.2694277
SQL> select floor(sqrt(price)) from harishbook;
FLOOR(SQRT(PRICE))
------------------
13
14
14
14
11
SQL> select ceil(qty) from harishbook;
CEIL(QTY)
----------
10
16
6
14
10
SQL> select sum(price) from harishbook;
SUM(PRICE)
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
----------
919
SQL> select avg(price) from harishbook;
AVG(PRICE)
----------
183.8
SQL> select min(qty) from harishbook;
MIN(QTY)
----------
6
SQL> select max(price) from harishbook;
MAX(PRICE)
----------
202
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
SQL COMMANDS USING CONSTRAINTS AND SUB QUERIES
SQL> create table departmen1(deptno number(6) primary key,dname varchar2(15) not null,location
varchar2(13) not null);
Table created.
SQL> insert into departmen1 values(1,'finance','newyork');
1 row created.
SQL> insert into departmen1 values(2,'marketting','thirupura');
1 row created.
SQL> insert into departmen1 values(3,'administration','dharmapuri');
1 row created.
SQL> insert into departmen1 values(4,'interiorde','thirunalveli ');
1 row created.
SQL> insert into departmen1 values(5,'transport','maadurai');
1 row created.
SQL> insert into departmen1 values(6,'travel','chennai');
1 row created.
SQL> insert into departmen1 values(7,'security','thirupura');
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
1 row created.
SQL> insert into departmen1 values(8,'imports','maadurai');
1 row created.
SQL> insert into departmen1 values(9,'exports','maadurai');
1 row created.
SQL> insert into departmen1 values(10,'food','dharmapuri');
1 row created.
SQL> select *from departmen1;
DEPTNO DNAME LOCATION
------ --------------- -------------
1 finance maadurai
2 marketting thirupura
3 administration dharmapuri
4 interiorde thirunalveli
5 transport maadurai
6 travel chennai
7 security thirupura
8 imports maadurai
9 exports maadurai
10 food dharmapuri
10 rows selected.
SQL> create table employ1(empno varchar2(4) primary key,ename varchar2(15),deptno
number(5)references departmen1,hiredate date,job varchar2(9),sal number(7,2),comm
number(7,2));
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
Table created.
SQL> insert into employ1 values(001,'ram',1,'19-jan-1991','manager',15000,3000);
1 row created.
SQL> insert into employ1 values(002,'harish',2,'06-may-1008','chiefexe',18800,8000);
1 row created.
SQL> insert into employ1 values(003,'raju',3,'01-may-1989','clerk',14555,567);
1 row created.
SQL> insert into employ1 values(004,'ramesh',4,'31-jan-1008','ca',17666,7564);
1 row created.
SQL> insert into employ1 values(005,'kumar',5,'29-apr-2000','account',20000,2000);
1 row created.
SQL> insert into employ1 values(006,'ragav',6,'09-dec-2001','manager',25000,2700);
1 row created.
SQL> insert into employ1 values(007,'raman',7,'11-nov-1008','clerk',25080,2430);
1 row created.
SQL> insert into employ1 values(008,'madan',8,'13-apr-2003','manager',28000,2420);
1 row created.
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
SQL> insert into employ1 values(009,'tommy',9,'19-apr-1991','ceo',28000,2500);
1 row created.
SQL> insert into employ1 values(010,'rajesh',10,'20-sep-2004','accounts',17000,2534);
1 row created.
SQL> select * from employ1;
EMPN ENAME DEPTNO HIREDATE JOB SAL COMM
---- --------------- ---------- --------- --------- ---------- ----------
001 ram 1 19-JAN-91 manager 15000 3000
002 harish 2 06-MAY-99 chiefexe 18800 8000
003 raju 3 01-MAY-89 clerk 14555 567
004 ramesh 4 31-JAN-99 ca 17666 7564
005 kumar 5 29-APR-00 account 20000 2000
006 ragav 6 09-DEC-01 manager 25000 2700
007 raman 7 11-NOV-99 clerk 25080 2430
008 madan 8 13-APR-03 manager 28000 2420
009 tommy 9 19-APR-91 ceo 28000 2500
010 rajesh 10 20-SEP-04 accounts 17000 2534
10 rows selected.
SQL> select * from employ1 where job='manager';
EMPN ENAME DEPTNO HIREDATE JOB SAL COMM
---- --------------- ---------- --------- --------- ---------- ----------
001 ram 1 19-JAN-91 manager 15000 3000
006 ragav 6 09-DEC-01 manager 25000 2700
008 madan 8 13-APR-03 manager 28000 2420
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
3 rows selected.
SQL> select *from employ1 where sal>(select min(sal) from employ1 group by deptno having
deptno=10);
EMPN ENAME DEPTNO HIREDATE JOB SAL COMM
---- --------------- ---------- --------- --------- ---------- ----------
002 harish 2 06-MAY-99 chiefexe 18800 8000
004 ramesh 4 31-JAN-99 ca 17666 7564
005 kumar 5 29-APR-00 account 20000 2000
006 ragav 6 09-DEC-01 manager 25000 2700
007 raman 7 11-NOV-99 clerk 25080 2430
008 madan 8 13-APR-03 manager 28000 2420
009 tommy 9 19-APR-91 ceo 28000 2500
7 rows selected.
SQL> select max(sal) from employ1 group by job having job='manager';
MAX(SAL)
----------
28000
1 row selected.
SQL> select job,max(sal) from employ1 group by job;
JOB MAX(SAL)
-------- ----------
Account 20000
Accounts 17000
ca 17666
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
ceo 28000
chiefexe 18800
clerk 25080
manager 28000
7 rows selected.
SQL> select ename,deptno from employ1 x where hiredate=(select max(hiredate) from employ1 y
where x.deptno=y.deptno);
ENAME DEPTNO
--------------- ----------
ram 1
harish 2
raju 3
ramesh 4
kumar 5
ragav 6
raman 7
madan 8
tommy 9
rajesh 10
10 rows selected.
SQL> select to_char(hiredate,'yyyy'),count(empno) from employ1 group by
to_char(hiredate,'yyyy') having count(empno)=(select max(count(empno)) from employ1 group by
to_char (hiredate,'yyyy'));
TO_C COUNT(EMPNO)
---- ------------
1008 3
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
1 row selected.
SQL> select ename ||' has '|| trunc(months_between(sysdate,hiredate)/12) ||' years
'||trunc(mod(months_between(sysdate,hiredate),12))||' months '||' as length of service' "length of
service" from employ1;
length of service
--------------------------------------------------------------------------ram has 19 years 0 months as
length of service
harish has 10 years 9 months as length of service
raju has 20 years 9 months as length of service
ramesh has 11 years 0 months as length of service
kumar has 9 years 9 months as length of service
ragav has 8 years 2 months as length of service
raman has 10 years 3 months as length of service
madan has 6 years 10 months as length of service
tommy has 18 years 9 months as length of service
rajesh has 5 years 4 months as length of service
10 rows selected.
SQL> select ename,location from employ1,departmen1 where employ1.deptno=departmen1.deptno
and location='maadurai';
ENAME LOCATION
--------------- -------------
Ram madurai
Kumar madurai
Madan madurai
Tommy madurai
4 rows selected.
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
SQL> select ename,dname from employ1,departmen1 where employ1.deptno=departmen1.deptno;
ENAME DNAME
--------------- ---------------
ram finance
harish marketting
raju administration
ramesh interiorde
kumar transport
ragav travel
raman security
madan imports
tommy exports
rajesh food
10 rows selected.
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
SQL COMMANDS USING JOINS
SQL> create table custom(cusid number(2) primary key,cusname varchar2(15) not null);
Table created.
SQL> insert into custom values(01,'pradeep');
1 row created.
SQL> insert into custom values(02,'raajan');
1 row created.
SQL> insert into custom values(03,'siva');
1 row created.
SQL> insert into custom values(04,'ragav');
1 row created.
SQL> insert into custom values(05,'aadhi');
1 row created.
SQL> select * from custom;
CUSID CUSNAME
---------- ---------------
1 pradeep
2 raajan
3 siva
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
4 ragav
5 aadhi
5 rows selected.
SQL> create table orde(prodid number(3),prodname varchar2(15) not null,cusid number(2)
references custom);
Table created.
SQL> insert into orde values(950,'windows',01);
1 row created.
SQL> insert into orde values(654,'mach',02);
1 row created.
SQL> insert into orde values(105,'red hat OS',03);
1 row created.
SQL> insert into orde values(089,'windows',04);
1 row created.
SQL> insert into orde values(534,'chromeOS',05);
1 row created.
SQL> select * from orde;
PRODID PRODNAME CUSID
---------- --------------- ----------
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
950 windows 1
654 mach 2
105 red hat OS 3
089 windows 4
534 chromeOS 5
5 rows selected.
SQL> select custom.cusid,cusname,prodname from custom inner join orde on
custom.cusid=orde.cusid;
CUSID CUSNAME PRODNAME
---------- --------------- ---------------
1 pradeep windows
2 raajan mach
3 siva red hat OS
4 ragav windows
5 aadhi chromeOS
5 rows selected.
SQL> select custom.cusid,cusname from custom inner join orde on custom.cusid =orde.cusid
where prodname='windows';
CUSID CUSNAME
---------- ---------------
1 pradeep
4 ragav
2 rows selected.
SQL> select custom.cusid,cusname,prodid,prodname from custom left join orde on custom . cusid
= orde.cusid;
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
CUSID CUSNAME PRODID PRODNAME
---------- --------------- ---------- ---------------
1 pradeep 950 windows
2 raajan 654 mach
3 siva 105 red hat OS
4 ragav 089 windows
5 aadhi 534 chromeOS
5 rows selected.
SQL> select custom.cusid,prodid,prodname from custom right join orde on
custom.cusid=orde.cusid;
CUSID PRODID PRODNAME
---------- ---------- ---------------
1 950 windows
2 654 mach
3 105 red hat OS
4 089 windows
5 534 chromeOS
5 rows selected.
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
UTILIZATION OF VIEW
SQL> create table harish1(name varchar2(20),rno number(5),marks number(5),primary key(rno));
Table created.
SQL> desc harish1;
Name Null? Type
----------------------------------------- -------- ----------------------
NAME VARCHAR2(20)
RNO NOT NULL NUMBER(5)
MARKS NUMBER(5)
SQL> insert into harish1 values('Narean',1001,350);
1 row created.
SQL> insert into harish1 values('Muzamil',1002,298);
1 row created.
SQL> insert into harish1 values('Raju',1003,375);
1 row created.
SQL> select*from harish1;
NAME RNO MARKS
-------------------- ---------- ----------
Narean 1001 350
Muzamil 1002 298
Raju 1003 375
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
SQL> create table harish2(rollno number(5),attendance number(5),primary key(rollno));
Table created.
SQL> desc harish2;
Name Null? Type
----------------------------------------- -------- ----------------------
ROLLNO NOT NULL NUMBER(5)
ATTENDANCE NUMBER(5)
SQL> insert into harish2 values(1001,90);
1 row created.
SQL> insert into harish2 values(1002,75);
1 row created.
SQL> insert into harish2 values(1003,85);
1 row created.
SQL> select*from harish2;
ROLLNO ATTENDANCE
---------- ----------
1001 90
1002 75
1003 85
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
SQL> create view harishview as select name,rno,marks,attendance from harish1,harish2 where
rollno=rno;
View created.
SQL> select*from harishview;
NAME RNO MARKS ATTENDANCE
-------------------- ---------- ---------- ----------
Narean 1001 350 90
Muzamil 1002 298 75
Raju 1003 375 85
SQL> select name,rno from harishview where rno=1001;
NAME RNO
-------------------- ----------
Narean 1001
SQL> update harishview set name='Ramesh' where name='Muzamil';
1 row updated.
SQL> select*from harishview;
NAME RNO MARKS ATTENDANCE
-------------------- ---------- ---------- ----------
Narean 1001 350 90
Ramesh 1002 298 75
Raju 1003 375 85
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
SQL> update harishview set marks=325 where name='Ramesh';
1 row updated.
SQL> select*from harishview;
NAME RNO MARKS ATTENDANCE
-------------------- ---------- ---------- ----------
Narean 1001 350 90
Ramesh 1002 325 75
Raju 1003 375 85
\
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
SQL COMMANDS USING JOINS
SQL> create table custom(cusid number(2) primary key,cusname varchar2(15) not null);
Table created.
SQL> insert into custom values(01,'pradeep');
1 row created.
SQL> insert into custom values(02,'raajan');
1 row created.
SQL> insert into custom values(03,'siva');
1 row created.
SQL> insert into custom values(04,'ragav');
1 row created.
SQL> insert into custom values(05,'aadhi');
1 row created.
SQL> select * from custom;
CUSID CUSNAME
---------- ---------------
1 pradeep
2 raajan
3 siva
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
4 ragav
5 aadhi
5 rows selected.
SQL> create table orde(prodid number(3),prodname varchar2(15) not null,cusid number(2)
references custom);
Table created.
SQL> insert into orde values(950,'windows',01);
1 row created.
SQL> insert into orde values(654,'mach',02);
1 row created.
SQL> insert into orde values(105,'red hat OS',03);
1 row created.
SQL> insert into orde values(089,'windows',04);
1 row created.
SQL> insert into orde values(534,'chromeOS',05);
1 row created.
SQL> select * from orde;
PRODID PRODNAME CUSID
---------- --------------- ----------
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
950 windows 1
654 mach 2
105 red hat OS 3
089 windows 4
534 chromeOS 5
5 rows selected.
SQL> select custom.cusid,cusname,prodname from custom inner join orde on
custom.cusid=orde.cusid;
CUSID CUSNAME PRODNAME
---------- --------------- ---------------
1 pradeep windows
2 raajan mach
3 siva red hat OS
4 ragav windows
5 aadhi chromeOS
5 rows selected.
SQL> select custom.cusid,cusname from custom inner join orde on custom.cusid =orde.cusid
where prodname='windows';
CUSID CUSNAME
---------- ---------------
1 pradeep
4 ragav
2 rows selected.
SQL> select custom.cusid,cusname,prodid,prodname from custom left join orde on custom . cusid
= orde.cusid;
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
CUSID CUSNAME PRODID PRODNAME
---------- --------------- ---------- ---------------
1 pradeep 950 windows
2 raajan 654 mach
3 siva 105 red hat OS
4 ragav 089 windows
5 aadhi 534 chromeOS
5 rows selected.
SQL> select custom.cusid,prodid,prodname from custom right join orde on
custom.cusid=orde.cusid;
CUSID PRODID PRODNAME
---------- ---------- ---------------
1 950 windows
2 654 mach
3 105 red hat OS
4 089 windows
5 534 chromeOS
5 rows selected.
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
PL/SQL PROGRAMS- PROCEDURES & FUNCTIONS
SQL> create table dept(deptno varchar2(6) primary key,deptname varchar2(15),location
varchar2(15));
Table created.
SQL> create table emp(empno varchar2(6) primary key,empname varchar2(10), deptno
varchar2(6),constraint dept foreign key(deptno) references dept (deptno),job varchar2(15),sal
number(7,2),comm number(6,2));
Table created.
SQL> desc dept
Name Null? Type
----------------------------------------- -------- ----------------
DEPTNO NOT NULL VARCHAR2(6)
DEPTNAME VARCHAR2(15)
LOCATION VARCHAR2(15)
SQL> desc emp
Name Null? Type
----------------------------------------- -------- ----------------
EMPNO NOT NULL VARCHAR2(6)
EMPNAME VARCHAR2(10)
DEPTNO VARCHAR2(6)
JOB VARCHAR2(15)
SAL NUMBER(7,2)
COMM NUMBER(6,2)
SQL> insert into dept values(1201,'HR','Chennai');
1 row created.
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
SQL> insert into dept values(1202,'Marketing','Covai');
1 row created.
SQL> insert into dept values(1203,'Exporting','Pondicherry');
1 row created.
SQL> select*from dept;
DEPTNO DEPTNAME LOCATION
------ --------------- ---------------
1201 HR Chennai
1202 Marketing Covai
1203 Exporting Pondicherry
SQL> insert into emp values(1051,'HarisH',1201,'Manager',12500,150);
1 row created.
SQL> insert into emp values(1089,'Muzamil',1203,'Chief',10000,120);
1 row created.
SQL> insert into emp values(1043,'Ramesh',1203,'Sales rep',9500,100);
1 row created.
SQL> insert into emp values(1045,'Guru',1203,'Sales rep',10000,100);
1 row created.
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
SQL> insert into emp values(1090,'Praveen',1202,'Rep',8500,90);
1 row created.
SQL> select*from emp;
EMPNO EMPNAME DEPTNO JOB SAL COMM
------ ---------- ------ --------------- ---------- ----------
1051 HarisH 1201 Manager 12500 150
1089 Muzamil 1202 Chief 10000 120
1043 Ramesh 1203 Sales rep 9500 100
1045 Guru 1203 Sales rep 10000 100
1090 Praveen 1202 Rep 8500 90
SQL> create or replace function nsal(n in number) return number as
2 cursor refemp is select sal from emp order by sal desc;
3 vsal emp.sal%type;
4 begin
5 open refemp;
6 loop
7 fetch refemp into vsal;
8 exit when refemp%rowcount=n;
9 end loop;
10 close refemp;
11 return vsal;
12 end;
13 /
Function created.
SQL> select nsal(2) from dual;
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
NSAL(2)
----------
10000
SQL> create or replace procedure empdisp(pdname in dept.deptname%type,pjob in emp.job%type)
as
2 cursor refemp(cur_dno emp.deptno%type) is select * from emp where deptno=cur_dno and
job=pjob;
3 edno dept.deptno%type;
4 eloc dept.location%type;
5 totsal emp.sal%type;
6 totcomm emp.comm%type;
7 grandtot emp.sal%type;
8 vemp emp%rowtype;
9 begin
10 totsal:=0;
11 totcomm:=0;
12 select deptno,location into edno,eloc from dept where deptname=pdname;
13 dbms_output.put_line('Department No: '||edno||' '||'Department Name:
'||pdname||' '||'Location: '||' '||eloc);
14 dbms_output.put_line(' Job: '||pjob);
15 dbms_output.put_line('Employee No Employee Name Salary
Commission');
16 open refemp(edno);
17 loop
18 fetch refemp into vemp;
19 exit when refemp%notfound;
20 dbms_output.put_line(vemp.empno||' '||vemp.empname||' '||vemp.sal||'
'||nvl(vemp.comm,0));
21 totsal:=totsal+vemp.sal;
22 totcomm:=totcomm+nvl(vemp.comm,0);
23 end loop;
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
24 dbms_output.put_line('Job Total :'||' '||totsal||' '||totcomm);
25 grandtot:=totsal+totcomm;
26 dbms_output.put_line('Grand Total:'||grandtot);
27 end;
28 /
Procedure created.
SQL> exec empdisp('HR','Manager');
Department No: 1201 Department Name: HR Location: chennai Job: Manager
Employee No Employee Name Salary Commission
1051 HarisH 12500 150
Job Total : 12500 150
Grand Total: 12650
PL/SQL procedure successfully completed.
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
PL/SQL PROGRAMS- TRIGGERS
SQL> create table accmaster(accno number(4) primary key,accname varchar2(20),opendate
date,acctype char,constraint ck_type check(acctype in('c','s','r')),bal number(9,2));
Table created.
SQL> create table acctrans(transno number(8) primary key,accno number(4),constraint acc foreign
key(accno) references accmaster(accno),transdate date,transamt number(9,2),transtype
char,constraint chk_trans check(transtype in('d','w')));
Table created.
SQL> insert into accmaster values(1001,'HarisH','25-mar-2000','s',1000);
1 row created.
SQL>insert into accmaster values(1002,'Muzamil','31-may-2000','r',1500);
1 row created.
SQL> insert into accmaster values(1003,'Subash','12-apr-2000','s',1750);
1 row created.
SQL> select*from accmaster;
ACCNO ACCNAME OPENDATE A BAL
---------- -------------------- --------- - ----------
1001 HarisH 25-MAR-00 s 1000
1002 Muzamil 31-MAY-00 r 1500
1003 Subash 12-APR-00 s 1750
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
SQL> create or replace trigger acc_update
2 after insert on acctrans
3 for each row
4 declare
5 vaccno acctrans.accno%type;
6 vtransamt acctrans.transamt%type;
7 vtranstype acctrans.transtype%type;
8 begin
9 vaccno:=:new.accno;
10 vtransamt:=:new.transamt;
11 vtranstype:=:new.transtype;
12 if vtranstype='d' then
13 update accmaster set bal=bal+vtransamt where accno=vaccno;
14 elsif vtranstype='w' then
15 update accmaster set bal=bal-vtransamt where accno=vaccno;
16 end if;
17 end;
18 /
Trigger created.
SQL> insert into acctrans values(500234,1001,'30-mar-2000',1000,'d');
1 row created.
SQL> insert into acctrans values(500238,1002,'17-apr-2010',300,'w');
1 row created.
SQL> insert into acctrans values(500236,1003,'31-mar-2010',50,'d');
1 row created.
SQL> select*from acctrans;
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
TRANSNO ACCNO TRANSDATE TRANSAMT T
---------- ---------- --------- ---------- -
500234 1001 30-MAR-00 1000 d
500238 1002 17-APR-10 300 w
500236 1003 31-MAR-10 50 d
SQL> create or replace trigger accmin
2 before insert on acctrans
3 for each row
4 declare
5 vaccno acctrans.accno%type;
6 vtransamt acctrans.transamt%type;
7 vtranstype acctrans.transtype%type;
8 vminbal accmaster.bal%type;
9 begin
10 vaccno:=:new.accno;
11 vtransamt:=:new.transamt;
12 vtranstype:=:new.transtype;
13 if vtranstype='w' then
14 select bal into vminbal from accmaster where accno=vaccno;
15 vminbal:=vminbal-vtransamt;
16 if vminbal<500 then
17 raise_application_error(-29329,'withdraw Is Not Possible');
18 elsif vminbal>500 then
19 update accmaster set bal=bal-vtransamt where accno=vaccno;
20 end if;
21 end if;
22 end;
23 /
Trigger created.
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
SQL> select*from accmaster;
ACCNO ACCNAME OPENDATE A BAL
---------- -------------------- --------- - ----------
1001 HarisH 25-MAR-00 s 2000
1002 Muzamil 31-MAY-00 r 1200
1003 Subash 12-APR-00 s 1800
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
STUDENTS FORM
CODINGS:
Dim db As Database
Dim rs As Recordset
Dim flag As Integer
Private Sub Form_Load()
Set db = OpenDatabase("C:\Documents and Settings\Administrator\Desktop\dbms.mdb")
Set rs = db.OpenRecordset("student")
MsgBox "connected"
Text1.Text = rs("sno")
Text2.Text = rs("sname")
Text3.Text = rs("mark1")
Text4.Text = rs("mark2")
Text5.Text = rs("total")
Text6.Text = rs("avg")
Text7.Text = rs("result")
End Sub
Private Sub CALCULATE_Click()
Text5.Text = Val(Text3.Text) + Val(Text4.Text)
Text6.Text = Val(Text5.Text) / 2
If Val(Text3.Text) > 25 And Val(Text4.Text) > 25 Then
Text7.Text = "PASS"
Else
Text7.Text = "FAIL"
End If
End Sub
Private Sub clear_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
End Sub
Private Sub DELETE_Click()
Dim x As String
x = MsgBox("do u want to delete?", vbYesNo, "delete")
If x = vbYes Then
MsgBox "deleted"
rs.DELETE
Else
MsgBox "not deleted"
End If
End Sub
Private Sub INSERT_Click()
rs.AddNew
End Sub
Private Sub SAVE_Click()
If rs.EditMode = dbEditAdd Then
rs("Sno") = Text1.Text
rs("sname") = Text2.Text
rs("mark1") = Text3.Text
rs("mark2") = Text4.Text
rs("total") = Text5.Text
rs("avg") = Text6.Text
rs("result") = Text7.Text
End If
rs.UPDATE
MsgBox "record added"
End Sub
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
Private Sub UPDATE_Click()
Adodc1.Recordset(0) = Text1.Text
Adodc1.Recordset(1) = Text2.Text
Adodc1.Recordset(2) = Text3.Text
Adodc1.Recordset(3) = Text4.Text
Adodc1.Recordset(4) = Text5.Text
Adodc1.Recordset(5) = Text6.Text
Adodc1.Recordset(6) = Text7.Text
Adodc1.Recordset.UPDATE
End Sub
Form Design:
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
Student Form with Record Added message:
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
Student Form with Deleted message:
Student Form with Input Data:
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
Student Form with Calculation of Total, Average and Result:
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
EMPLOYEE PAYROLL PROCESSING
CODINGS:
Dim db As Database
Dim rs As Recordset
Private Sub Form_Load()
Set db = opendatabase("C:\Documents and Settings\Administrator\Desktop\employee.mdb")
Set rs = db.openrecordset("employee")
MsgBox "connected"
End Sub
Private Sub Insert_Click()
rs.addnew
End Sub
Private Sub Save_Click()
If rs.EditMode = dbEditAdd Then
rs("Eno") = Text1.Text
rs("Ename") = Text2.Text
rs("edept") = Text3.Text
rs("ejob") = Text4.Text
rs("basic") = Text5.Text
rs("pf") = Text6.Text
rs("da") = Text7.Text
rs("hra") = Text8.Text
rs("gross sal") = Text9.Text
rs("net sal") = Text10.Text
End If
rs.Update
MsgBox "record added"
End Sub
Private Sub Calculate_Click()
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
Text9.Text = Val(Text5.Text) + Val(Text7.Text) + Val(Text8.Text)
Text10.Text = Val(Text9.Text) - Val(Text6.Text)
End Sub
Private Sub Clear_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
End Sub
Form Design:
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
Employee Form with Input Entries:
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
Employee Form with Salary Calculation:
Employee Form with Record Added message:
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
LIBRARY MANAGEMENT SYSTEM
CODINGS:
Form 1:
Dim db As Database
Dim rs As Recordset
Private Sub Form_Load()
Set db = opendatabase("C:\Documents and Settings\NSIT\My Documents\lib.mdb")
Set rs = db.openrecordset("lib")
MsgBox "connected"
End Sub
Private Sub Save_Click()
If rs.EditMode = dbEditAdd Then
rs("code") = Text1.Text
rs("desc") = Text2.Text
rs("total") = Text3.Text
End If
rs.Update
End Sub
Private Sub Insert_Click()
rs.AddNew
End Sub
Private Sub Next_Click()
Form2.Show
End Sub
Form 2:
Dim db As Database
Dim rs As Recordset
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
Private Sub Form_Load()
Set db = opendatabase("C:\Documents and Settings\NSIT\My Documents\lib.mdb")
Set rs = db.openrecordset("lib1")
MsgBox "connected"
End Sub
Private Sub Insert_Click()
rs.AddNew
End Sub
Private Sub Delete_Click()
Dim xs As String
xs = MsgBox("Do u want to delete?", vbYesNo, "delete")
If xs = vbYes Then
rs.Delete
MsgBox "deleted"
Else
MsgBox "not deleted"
End If
End Sub
Private Sub Save_Click()
If rs.EditMode = dbEditAdd Then
rs("acno") = Text1.Text
rs("author") = Text2.Text
rs("price") = Text3.Text
rs("sno") = Text4.Text
rs("btitle") = Text5.Text
rs("publication") = Text6.Text
rs("status") = Text7.Text
End If
rs.Update
End Sub
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
Private Sub Next_Click()
Form3.Show
End Sub
Form 3:
Dim db As Database
Dim rs As Recordset
Private Sub Form_Load()
Set db = opendatabase("C:\Documents and Settings\NSIT\My Documents\lib.mdb")
Set rs = db.openrecordset("lib2")
MsgBox "connected"
End Sub
Private Sub Insert_Click()
rs.AddNew
End Sub
Private Sub Save_Click()
If rs.EditMode = dbEditAdd Then
rs("tno") = Text1.Text
rs("sname") = Text2.Text
rs("tdate") = Text3.Text
rs("sno") = Text4.Text
rs("acno") = Text5.Text
rs("ttype") = Text6.Text
rs.Update
End Sub
Design Form 1:
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
Design Form 2:
Design Form 3:
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
Save the data :
CS6312-DBMS DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING L.S.VIGNESH AP/CSE
Insert the data: