SlideShare uma empresa Scribd logo
1 de 21
INSURANCE DATABASE
SQL> create table person
2 (driver_id varchar(5) primary key,name char(10),
3 address varchar(10));
Table created.
SQL> desc person;
Name Null? Type
------------------------------- -------- ----
DRIVER_ID NOT NULL VARCHAR2(5)
NAME CHAR(10)
ADDRESS VARCHAR2(10)
SQL> insert into person
2 values('&driver_id','&name','&address');
Enter value for driver_id: 111
Enter value for name: vijay
Enter value for address: bgm
old 2: values('&driver_id','&name','&address')
new 2: values('111','vijay','bgm')
SGI’S
BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE
SHAIKH CAMPUS NEHRU NAGAR BELGAUM
Page 1
INSURANCE DATABASE
1 row created.
SQL> /
Enter value for driver_id: 222
Enter value for name: salman
Enter value for address: goa
old 2: values('&driver_id','&name','&address')
new 2: values('222','salman','goa')
1 row created.
SQL> /
Enter value for driver_id: 333
Enter value for name: sam
Enter value for address: bgm
old 2: values('&driver_id','&name','&address')
new 2: values('333','sam','bgm')
1 row created.
SQL> /
Enter value for driver_id: 444
SGI’S
BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE
SHAIKH CAMPUS NEHRU NAGAR BELGAUM
Page 2
INSURANCE DATABASE
Enter value for name: ganesh
Enter value for address: nepal
old 2: values('&driver_id','&name','&address')
new 2: values('444','ganesh','nepal')
1 row created.
SQL> /
Enter value for driver_id: 555
Enter value for name: reshma
Enter value for address: bgm
old 2: values('&driver_id','&name','&address')
new 2: values('555','reshma','bgm')
1 row created.
SQL> select * from person;
DRIVE NAME ADDRESS
----- ---------- ----------
111 vijay bgm
222 salman goa
SGI’S
BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE
SHAIKH CAMPUS NEHRU NAGAR BELGAUM
Page 3
INSURANCE DATABASE
333 sam bgm
444 ganesh nepal
555 reshma bgm
SQL> create table car
2 (reg_no varchar(10) primary key,model varchar(5),year number(5
Table created.
SQL> desc car;
Name Null? Type
------------------------------- -------- ----
REG_NO NOT NULL VARCHAR2(10)
MODEL VARCHAR2(5)
YEAR NUMBER(5)
SGI’S
BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE
SHAIKH CAMPUS NEHRU NAGAR BELGAUM
Page 4
INSURANCE DATABASE
SQL> insert into car
2 values('&reg_no','&model',&year);
Enter value for reg_no: a111
Enter value for model: i10
Enter value for year: 2006
old 2: values('&reg_no','&model',&year)
new 2: values('a111','i10',2006)
1 row created.
SQL> /
Enter value for reg_no: b222
Enter value for model: i20
Enter value for year: 2010
old 2: values('&reg_no','&model',&year)
new 2: values('b222','i20',2010)
1 row created.
SQL> /
SGI’S
BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE
SHAIKH CAMPUS NEHRU NAGAR BELGAUM
Page 5
INSURANCE DATABASE
Enter value for reg_no: c333
Enter value for model: alto
Enter value for year: 2002
old 2: values('&reg_no','&model',&year)
new 2: values('c333','alto',2002)
1 row created.
SQL> /
Enter value for reg_no: d444
Enter value for model: bmw
Enter value for year: 2005
old 2: values('&reg_no','&model',&year)
new 2: values('d444','bmw',2005)
1 row created.
SQL> /
Enter value for reg_no: e555
Enter value for model: audi
Enter value for year: 2003
old 2: values('&reg_no','&model',&year)
new 2: values('e555','audi',2003)
SGI’S
BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE
SHAIKH CAMPUS NEHRU NAGAR BELGAUM
Page 6
INSURANCE DATABASE
1 row created.
SQL> select * from car;
REG_NO MODEL YEAR
---------- ----- ---------
a111 i10 2006
b222 i20 2010
c333 alto 2002
d444 bmw 2005
e555 audi 2003
SQL> create table accident
2 (report_no number(5) primary key, acc_date date,location
varchar(10));
SGI’S
BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE
SHAIKH CAMPUS NEHRU NAGAR BELGAUM
Page 7
INSURANCE DATABASE
Table created.
SQL> desc accident;
Name Null? Type
------------------------------- -------- ----
REPORT_NO NOT NULL NUMBER(5)
ACC_DATE DATE
LOCATION VARCHAR2(10)
SQL> insert into accident
2 values(&report_no,'&acc_date','&location');
Enter value for report_no: 1
Enter value for acc_date: 1-jan-2001
Enter value for location: bgm
old 2: values(&report_no,'&acc_date','&location')
new 2: values(1,'1-jan-2001','bgm')
1 row created.
SQL> /
SGI’S
BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE
SHAIKH CAMPUS NEHRU NAGAR BELGAUM
Page 8
INSURANCE DATABASE
Enter value for report_no: 2
Enter value for acc_date: 25-dec-2006
Enter value for location: goa
old 2: values(&report_no,'&acc_date','&location')
new 2: values(2,'25-dec-2006','goa')
1 row created.
SQL> /
Enter value for report_no: 3
Enter value for acc_date: 12-june-2003
Enter value for location: bgm
old 2: values(&report_no,'&acc_date','&location')
new 2: values(3,'12-june-2003','bgm')
1 row created.
SQL> /
Enter value for report_no: 4
Enter value for acc_date: 31-dec-2003
Enter value for location: bgm
old 2: values(&report_no,'&acc_date','&location')
new 2: values(4,'31-dec-2003','bgm')
SGI’S
BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE
SHAIKH CAMPUS NEHRU NAGAR BELGAUM
Page 9
INSURANCE DATABASE
1 row created.
SQL> /
Enter value for report_no: 5
Enter value for acc_date: 2-jan-2004
Enter value for location: goa
old 2: values(&report_no,'&acc_date','&location')
new 2: values(5,'2-jan-2004','goa')
1 row created.
SQL> select * from accident;
REPORT_NO ACC_DATE LOCATION
--------- --------- ----------
1 01-JAN-01 bgm
2 25-DEC-06 goa
3 12-JUN-03 bgm
4 31-DEC-03 bgm
5 02-JAN-04 goa
SQL> create table owns
SGI’S
BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE
SHAIKH CAMPUS NEHRU NAGAR BELGAUM
Page 10
INSURANCE DATABASE
2 (driver_id varchar(5), reg_no varchar(10),
3 foreign key(driver_id) references person(driver_id),
4 foreign key(reg_no) references car(reg_no));
Table created.
SQL> desc owns;
Name Null? Type
------------------------------- -------- ----
DRIVER_ID VARCHAR2(5)
REG_NO VARCHAR2(10)
SQL> insert into owns
2 values('&driver_id','&reg_no');
Enter value for driver_id: 111
Enter value for reg_no: a111
old 2: values('&driver_id','&reg_no')
new 2: values('111','a111')
1 row created.
SGI’S
BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE
SHAIKH CAMPUS NEHRU NAGAR BELGAUM
Page 11
INSURANCE DATABASE
SQL> /
Enter value for driver_id: 222
Enter value for reg_no: b222
old 2: values('&driver_id','&reg_no')
new 2: values('222','b222')
1 row created.
SQL> /
Enter value for driver_id: 333
Enter value for reg_no: c333
old 2: values('&driver_id','&reg_no')
new 2: values('333','c333')
1 row created.
SQL> /
Enter value for driver_id: 444
Enter value for reg_no: d444
old 2: values('&driver_id','&reg_no')
new 2: values('444','d444')
SGI’S
BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE
SHAIKH CAMPUS NEHRU NAGAR BELGAUM
Page 12
INSURANCE DATABASE
1 row created.
SQL> /
Enter value for driver_id: 555
Enter value for reg_no: e555
old 2: values('&driver_id','&reg_no')
new 2: values('555','e555')
1 row created.
SQL> select * from owns;
DRIVE REG_NO
----- ----------
111 a111
222 b222
333 c333
444 d444
555 e555
SGI’S
BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE
SHAIKH CAMPUS NEHRU NAGAR BELGAUM
Page 13
INSURANCE DATABASE
SQL> commit;
Commit complete.
SQL> create table participated
2 (driver_id varchar(5),reg_no varchar(10),report_no number(5),
3 damage_amt number(6),
4 foreign key(driver_id) references person(driver_id),
5 foreign key(reg_no) references car(reg_no),
6 foreign key(report_no) references accident(report_no));
Table created.
SQL> desc participated;
Name Null? Type
------------------------------- -------- ----
DRIVER_ID VARCHAR2(5)
REG_NO VARCHAR2(10)
REPORT_NO NUMBER(5)
DAMAGE_AMT NUMBER(6)
SGI’S
BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE
SHAIKH CAMPUS NEHRU NAGAR BELGAUM
Page 14
INSURANCE DATABASE
SQL> insert into participated
2 values('&driver_id','&reg_no',&report_no,&damage_amt);
Enter value for driver_id: 111
Enter value for reg_no: a111
Enter value for report_no: 1
Enter value for damage_amt: 15000
old 2: values('&driver_id','&reg_no',&report_no,&damage_amt)
new 2: values('111','a111',1,15000)
1 row created.
SQL> /
Enter value for driver_id: 222
Enter value for reg_no: b222
Enter value for report_no: 2
Enter value for damage_amt: 10000
old 2: values('&driver_id','&reg_no',&report_no,&damage_amt)
new 2: values('222','b222',2,10000)
1 row created.
SQL> /
Enter value for driver_id: 333
Enter value for reg_no: c333
Enter value for report_no: 3
Enter value for damage_amt: 30000
SGI’S
BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE
SHAIKH CAMPUS NEHRU NAGAR BELGAUM
Page 15
INSURANCE DATABASE
old 2: values('&driver_id','&reg_no',&report_no,&damage_amt)
new 2: values('333','c333',3,30000)
1 row created.
SQL> /
Enter value for driver_id: 444
Enter value for reg_no: d444
Enter value for report_no: 4
Enter value for damage_amt: 12000
old 2: values('&driver_id','&reg_no',&report_no,&damage_amt)
new 2: values('444','d444',4,12000)
1 row created.
SQL> /
Enter value for driver_id: 555
Enter value for reg_no: e555
Enter value for report_no: 5
Enter value for damage_amt: 50000
old 2: values('&driver_id','&reg_no',&report_no,&damage_amt)
new 2: values('555','e555',5,50000)
1 row created.
SQL> select * from participated;
SGI’S
BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE
SHAIKH CAMPUS NEHRU NAGAR BELGAUM
Page 16
INSURANCE DATABASE
DRIVE REG_NO REPORT_NO DAMAGE_AMT
----- ---------- --------- ----------
111 a111 1 15000
222 b222 2 10000
333 c333 3 30000
444 d444 4 12000
555 e555 5 50000
QUERY 1 : UPDATE THE DAMAGE AMOUNT FOR THE CAR WITH A REGISTER
NUMBER,IN THE ACCIDENT WITH REPORT NUMBER 12 TO 25000.
SQL> SQL> update participated
2 set damage_amt=25000
3 where reg_no='&reg_no'AND report_no=1;
Enter value for reg_no: a111
old 3: where reg_no='&reg_no'AND report_no=1
new 3: where reg_no='a111'AND report_no=1
1 row updated.
SGI’S
BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE
SHAIKH CAMPUS NEHRU NAGAR BELGAUM
Page 17
INSURANCE DATABASE
SQL> select * from participated;
DRIVE REG_NO REPORT_NO DAMAGE_AMT
----- ---------- --------- ----------
111 a111 1 25000
222 b222 2 10000
333 c333 3 30000
444 d444 4 12000
555 e555 5 50000
QUERY 2 : ADD A NEW ACCIDENT TO THE DATABASE.
SQL> insert into accident
2 values(6,'12-apr-2001','delhi');
1 row created.
SQL> select * from accident;
REPORT_NO ACC_DATE LOCATION
--------- --------- ----------
1 01-JAN-01 bgm
2 25-DEC-06 goa
3 12-JUN-03 bgm
SGI’S
BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE
SHAIKH CAMPUS NEHRU NAGAR BELGAUM
Page 18
INSURANCE DATABASE
4 31-DEC-03 bgm
5 02-JAN-04 goa
6 12-APR-01 delhi
6 rows selected.
SQL> select * from accident;
REPORT_NO ACC_DATE LOCATION
--------- --------- ----------
1 01-JAN-01 bgm
2 25-DEC-06 goa
3 12-JUN-03 bgm
4 31-DEC-03 bgm
5 02-JAN-04 goa
6 12-APR-01 delhi
6 rows selected.
Query 4 : FIND THE TOTAL NUMBER OF PEOPLE WHO OWNED CARS THAT WHERE
INVOLVED IN ACCIDENTS IN YEAR 2003
SQL> select count(*) AS Total_No_Of_Persons
2 from person p,accident a,participated d
3 where acc_date like '%03'AND
SGI’S
BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE
SHAIKH CAMPUS NEHRU NAGAR BELGAUM
Page 19
INSURANCE DATABASE
4 d.driver_id=p.driver_id
5 AND a.report_no=d.report_no;
TOTAL_NO_OF_PERSONS
-------------------
2
QUERY 5 : FIND THE NUMBER OF ACCIDENTS IN WHICH CARS BELONGING TO A
SPECIFIC MODEL WHERE INVOLVED.
SQL> select count(*) AS Total_No_Of_Accident
2 from accident a,car c, participated p
3 where model='&model' AND p.reg_no=c.reg_no AND
4 a.report_no=p.report_no;
Enter value for model: i10
old 3: where model='&model' AND p.reg_no=c.reg_no AND
new 3: where model='i10' AND p.reg_no=c.reg_no AND
TOTAL_NO_OF_ACCIDENT
--------------------
1
SGI’S
BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE
SHAIKH CAMPUS NEHRU NAGAR BELGAUM
Page 20
INSURANCE DATABASE
SQL> select * from car;
REG_NO MODEL YEAR
---------- ----- ---------
a111 i10 2006
b222 i20 2010
c333 alto 2002
d444 bmw 2005
e555 audi 2003
************************* END OF TERM WORK 1**************************
SGI’S
BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE
SHAIKH CAMPUS NEHRU NAGAR BELGAUM
Page 21

Mais conteúdo relacionado

Semelhante a Dbms lab 01 termwork1

CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORYCS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORYRadha Maruthiyan
 
Neo4j Makes Graphs Easy: Nicole White
Neo4j Makes Graphs Easy: Nicole WhiteNeo4j Makes Graphs Easy: Nicole White
Neo4j Makes Graphs Easy: Nicole WhiteNeo4j
 
1 Database Security Lab 2 – Virtual Private Database.docx
1 Database Security Lab 2 – Virtual Private Database.docx1 Database Security Lab 2 – Virtual Private Database.docx
1 Database Security Lab 2 – Virtual Private Database.docxjeremylockett77
 
Sangam 2019 - The Latest Features
Sangam 2019 - The Latest FeaturesSangam 2019 - The Latest Features
Sangam 2019 - The Latest FeaturesConnor McDonald
 
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and OptimizationPgDay.Seoul
 
Oracle Database 12c Application Development
Oracle Database 12c Application DevelopmentOracle Database 12c Application Development
Oracle Database 12c Application DevelopmentSaurabh K. Gupta
 
OpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developersOpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developersConnor McDonald
 
DN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project A
DN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project ADN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project A
DN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project ADataconomy Media
 
CCM Escape Case Study - SkySQL Paris Meetup 17.12.2013
CCM Escape Case Study - SkySQL Paris Meetup 17.12.2013CCM Escape Case Study - SkySQL Paris Meetup 17.12.2013
CCM Escape Case Study - SkySQL Paris Meetup 17.12.2013MariaDB Corporation
 
Plsql task answers
Plsql task answersPlsql task answers
Plsql task answersNawaz Sk
 
Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output)Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output)Aman Deep
 
Tech Altum :- Angular introduction, Installation and directives
Tech Altum :- Angular introduction, Installation and directivesTech Altum :- Angular introduction, Installation and directives
Tech Altum :- Angular introduction, Installation and directivesTech Altum
 
Database Development Replication Security Maintenance Report
Database Development Replication Security Maintenance ReportDatabase Development Replication Security Maintenance Report
Database Development Replication Security Maintenance Reportnyin27
 
Windowing Functions - Little Rock Tech Fest 2019
Windowing Functions - Little Rock Tech Fest 2019Windowing Functions - Little Rock Tech Fest 2019
Windowing Functions - Little Rock Tech Fest 2019Dave Stokes
 

Semelhante a Dbms lab 01 termwork1 (20)

Plsql lab mannual
Plsql lab mannualPlsql lab mannual
Plsql lab mannual
 
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORYCS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
 
Neo4j Makes Graphs Easy: Nicole White
Neo4j Makes Graphs Easy: Nicole WhiteNeo4j Makes Graphs Easy: Nicole White
Neo4j Makes Graphs Easy: Nicole White
 
February0504 pm
February0504 pmFebruary0504 pm
February0504 pm
 
1 Database Security Lab 2 – Virtual Private Database.docx
1 Database Security Lab 2 – Virtual Private Database.docx1 Database Security Lab 2 – Virtual Private Database.docx
1 Database Security Lab 2 – Virtual Private Database.docx
 
Sangam 2019 - The Latest Features
Sangam 2019 - The Latest FeaturesSangam 2019 - The Latest Features
Sangam 2019 - The Latest Features
 
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
 
Oracle Database 12c Application Development
Oracle Database 12c Application DevelopmentOracle Database 12c Application Development
Oracle Database 12c Application Development
 
OpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developersOpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developers
 
Check Constraint In MySQL 8.0
Check Constraint  In MySQL 8.0Check Constraint  In MySQL 8.0
Check Constraint In MySQL 8.0
 
Sql queries
Sql queriesSql queries
Sql queries
 
DN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project A
DN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project ADN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project A
DN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project A
 
angular fundamentals.pdf
angular fundamentals.pdfangular fundamentals.pdf
angular fundamentals.pdf
 
CCM Escape Case Study - SkySQL Paris Meetup 17.12.2013
CCM Escape Case Study - SkySQL Paris Meetup 17.12.2013CCM Escape Case Study - SkySQL Paris Meetup 17.12.2013
CCM Escape Case Study - SkySQL Paris Meetup 17.12.2013
 
Plsql task answers
Plsql task answersPlsql task answers
Plsql task answers
 
22 code snippet_web_services_2
22 code snippet_web_services_222 code snippet_web_services_2
22 code snippet_web_services_2
 
Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output)Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output)
 
Tech Altum :- Angular introduction, Installation and directives
Tech Altum :- Angular introduction, Installation and directivesTech Altum :- Angular introduction, Installation and directives
Tech Altum :- Angular introduction, Installation and directives
 
Database Development Replication Security Maintenance Report
Database Development Replication Security Maintenance ReportDatabase Development Replication Security Maintenance Report
Database Development Replication Security Maintenance Report
 
Windowing Functions - Little Rock Tech Fest 2019
Windowing Functions - Little Rock Tech Fest 2019Windowing Functions - Little Rock Tech Fest 2019
Windowing Functions - Little Rock Tech Fest 2019
 

Mais de Jafar Nesargi

Network adpater,cabel,cards ,types, network devices
Network adpater,cabel,cards ,types, network devicesNetwork adpater,cabel,cards ,types, network devices
Network adpater,cabel,cards ,types, network devicesJafar Nesargi
 
An introduction to networking
An introduction to networkingAn introduction to networking
An introduction to networkingJafar Nesargi
 
Chapter 7 relation database language
Chapter 7 relation database languageChapter 7 relation database language
Chapter 7 relation database languageJafar Nesargi
 
Chapter 6 relational data model and relational
Chapter  6  relational data model and relationalChapter  6  relational data model and relational
Chapter 6 relational data model and relationalJafar Nesargi
 
Chapter 4 record storage and primary file organization
Chapter 4 record storage and primary file organizationChapter 4 record storage and primary file organization
Chapter 4 record storage and primary file organizationJafar Nesargi
 
Introduction to-oracle
Introduction to-oracleIntroduction to-oracle
Introduction to-oracleJafar Nesargi
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheetsJafar Nesargi
 
Session1 gateway to web page development
Session1   gateway to web page developmentSession1   gateway to web page development
Session1 gateway to web page developmentJafar Nesargi
 
Chapter 3 servlet & jsp
Chapter 3 servlet & jspChapter 3 servlet & jsp
Chapter 3 servlet & jspJafar Nesargi
 
Record storage and primary file organization
Record storage and primary file organizationRecord storage and primary file organization
Record storage and primary file organizationJafar Nesargi
 
Introduction to-oracle
Introduction to-oracleIntroduction to-oracle
Introduction to-oracleJafar Nesargi
 

Mais de Jafar Nesargi (20)

Network adpater,cabel,cards ,types, network devices
Network adpater,cabel,cards ,types, network devicesNetwork adpater,cabel,cards ,types, network devices
Network adpater,cabel,cards ,types, network devices
 
An introduction to networking
An introduction to networkingAn introduction to networking
An introduction to networking
 
Css
CssCss
Css
 
Chapter 7 relation database language
Chapter 7 relation database languageChapter 7 relation database language
Chapter 7 relation database language
 
Chapter 6 relational data model and relational
Chapter  6  relational data model and relationalChapter  6  relational data model and relational
Chapter 6 relational data model and relational
 
Chapter 4 record storage and primary file organization
Chapter 4 record storage and primary file organizationChapter 4 record storage and primary file organization
Chapter 4 record storage and primary file organization
 
Chapter3
Chapter3Chapter3
Chapter3
 
Introduction to-oracle
Introduction to-oracleIntroduction to-oracle
Introduction to-oracle
 
Chapter2
Chapter2Chapter2
Chapter2
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
 
Session1 gateway to web page development
Session1   gateway to web page developmentSession1   gateway to web page development
Session1 gateway to web page development
 
Introduction to jsp
Introduction to jspIntroduction to jsp
Introduction to jsp
 
Chapter 3 servlet & jsp
Chapter 3 servlet & jspChapter 3 servlet & jsp
Chapter 3 servlet & jsp
 
Rmi
RmiRmi
Rmi
 
Java bean
Java beanJava bean
Java bean
 
Networking
NetworkingNetworking
Networking
 
Chapter2 j2ee
Chapter2 j2eeChapter2 j2ee
Chapter2 j2ee
 
Chapter 1 swings
Chapter 1 swingsChapter 1 swings
Chapter 1 swings
 
Record storage and primary file organization
Record storage and primary file organizationRecord storage and primary file organization
Record storage and primary file organization
 
Introduction to-oracle
Introduction to-oracleIntroduction to-oracle
Introduction to-oracle
 

Último

Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 

Último (20)

Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 

Dbms lab 01 termwork1

  • 1. INSURANCE DATABASE SQL> create table person 2 (driver_id varchar(5) primary key,name char(10), 3 address varchar(10)); Table created. SQL> desc person; Name Null? Type ------------------------------- -------- ---- DRIVER_ID NOT NULL VARCHAR2(5) NAME CHAR(10) ADDRESS VARCHAR2(10) SQL> insert into person 2 values('&driver_id','&name','&address'); Enter value for driver_id: 111 Enter value for name: vijay Enter value for address: bgm old 2: values('&driver_id','&name','&address') new 2: values('111','vijay','bgm') SGI’S BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE SHAIKH CAMPUS NEHRU NAGAR BELGAUM Page 1
  • 2. INSURANCE DATABASE 1 row created. SQL> / Enter value for driver_id: 222 Enter value for name: salman Enter value for address: goa old 2: values('&driver_id','&name','&address') new 2: values('222','salman','goa') 1 row created. SQL> / Enter value for driver_id: 333 Enter value for name: sam Enter value for address: bgm old 2: values('&driver_id','&name','&address') new 2: values('333','sam','bgm') 1 row created. SQL> / Enter value for driver_id: 444 SGI’S BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE SHAIKH CAMPUS NEHRU NAGAR BELGAUM Page 2
  • 3. INSURANCE DATABASE Enter value for name: ganesh Enter value for address: nepal old 2: values('&driver_id','&name','&address') new 2: values('444','ganesh','nepal') 1 row created. SQL> / Enter value for driver_id: 555 Enter value for name: reshma Enter value for address: bgm old 2: values('&driver_id','&name','&address') new 2: values('555','reshma','bgm') 1 row created. SQL> select * from person; DRIVE NAME ADDRESS ----- ---------- ---------- 111 vijay bgm 222 salman goa SGI’S BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE SHAIKH CAMPUS NEHRU NAGAR BELGAUM Page 3
  • 4. INSURANCE DATABASE 333 sam bgm 444 ganesh nepal 555 reshma bgm SQL> create table car 2 (reg_no varchar(10) primary key,model varchar(5),year number(5 Table created. SQL> desc car; Name Null? Type ------------------------------- -------- ---- REG_NO NOT NULL VARCHAR2(10) MODEL VARCHAR2(5) YEAR NUMBER(5) SGI’S BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE SHAIKH CAMPUS NEHRU NAGAR BELGAUM Page 4
  • 5. INSURANCE DATABASE SQL> insert into car 2 values('&reg_no','&model',&year); Enter value for reg_no: a111 Enter value for model: i10 Enter value for year: 2006 old 2: values('&reg_no','&model',&year) new 2: values('a111','i10',2006) 1 row created. SQL> / Enter value for reg_no: b222 Enter value for model: i20 Enter value for year: 2010 old 2: values('&reg_no','&model',&year) new 2: values('b222','i20',2010) 1 row created. SQL> / SGI’S BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE SHAIKH CAMPUS NEHRU NAGAR BELGAUM Page 5
  • 6. INSURANCE DATABASE Enter value for reg_no: c333 Enter value for model: alto Enter value for year: 2002 old 2: values('&reg_no','&model',&year) new 2: values('c333','alto',2002) 1 row created. SQL> / Enter value for reg_no: d444 Enter value for model: bmw Enter value for year: 2005 old 2: values('&reg_no','&model',&year) new 2: values('d444','bmw',2005) 1 row created. SQL> / Enter value for reg_no: e555 Enter value for model: audi Enter value for year: 2003 old 2: values('&reg_no','&model',&year) new 2: values('e555','audi',2003) SGI’S BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE SHAIKH CAMPUS NEHRU NAGAR BELGAUM Page 6
  • 7. INSURANCE DATABASE 1 row created. SQL> select * from car; REG_NO MODEL YEAR ---------- ----- --------- a111 i10 2006 b222 i20 2010 c333 alto 2002 d444 bmw 2005 e555 audi 2003 SQL> create table accident 2 (report_no number(5) primary key, acc_date date,location varchar(10)); SGI’S BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE SHAIKH CAMPUS NEHRU NAGAR BELGAUM Page 7
  • 8. INSURANCE DATABASE Table created. SQL> desc accident; Name Null? Type ------------------------------- -------- ---- REPORT_NO NOT NULL NUMBER(5) ACC_DATE DATE LOCATION VARCHAR2(10) SQL> insert into accident 2 values(&report_no,'&acc_date','&location'); Enter value for report_no: 1 Enter value for acc_date: 1-jan-2001 Enter value for location: bgm old 2: values(&report_no,'&acc_date','&location') new 2: values(1,'1-jan-2001','bgm') 1 row created. SQL> / SGI’S BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE SHAIKH CAMPUS NEHRU NAGAR BELGAUM Page 8
  • 9. INSURANCE DATABASE Enter value for report_no: 2 Enter value for acc_date: 25-dec-2006 Enter value for location: goa old 2: values(&report_no,'&acc_date','&location') new 2: values(2,'25-dec-2006','goa') 1 row created. SQL> / Enter value for report_no: 3 Enter value for acc_date: 12-june-2003 Enter value for location: bgm old 2: values(&report_no,'&acc_date','&location') new 2: values(3,'12-june-2003','bgm') 1 row created. SQL> / Enter value for report_no: 4 Enter value for acc_date: 31-dec-2003 Enter value for location: bgm old 2: values(&report_no,'&acc_date','&location') new 2: values(4,'31-dec-2003','bgm') SGI’S BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE SHAIKH CAMPUS NEHRU NAGAR BELGAUM Page 9
  • 10. INSURANCE DATABASE 1 row created. SQL> / Enter value for report_no: 5 Enter value for acc_date: 2-jan-2004 Enter value for location: goa old 2: values(&report_no,'&acc_date','&location') new 2: values(5,'2-jan-2004','goa') 1 row created. SQL> select * from accident; REPORT_NO ACC_DATE LOCATION --------- --------- ---------- 1 01-JAN-01 bgm 2 25-DEC-06 goa 3 12-JUN-03 bgm 4 31-DEC-03 bgm 5 02-JAN-04 goa SQL> create table owns SGI’S BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE SHAIKH CAMPUS NEHRU NAGAR BELGAUM Page 10
  • 11. INSURANCE DATABASE 2 (driver_id varchar(5), reg_no varchar(10), 3 foreign key(driver_id) references person(driver_id), 4 foreign key(reg_no) references car(reg_no)); Table created. SQL> desc owns; Name Null? Type ------------------------------- -------- ---- DRIVER_ID VARCHAR2(5) REG_NO VARCHAR2(10) SQL> insert into owns 2 values('&driver_id','&reg_no'); Enter value for driver_id: 111 Enter value for reg_no: a111 old 2: values('&driver_id','&reg_no') new 2: values('111','a111') 1 row created. SGI’S BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE SHAIKH CAMPUS NEHRU NAGAR BELGAUM Page 11
  • 12. INSURANCE DATABASE SQL> / Enter value for driver_id: 222 Enter value for reg_no: b222 old 2: values('&driver_id','&reg_no') new 2: values('222','b222') 1 row created. SQL> / Enter value for driver_id: 333 Enter value for reg_no: c333 old 2: values('&driver_id','&reg_no') new 2: values('333','c333') 1 row created. SQL> / Enter value for driver_id: 444 Enter value for reg_no: d444 old 2: values('&driver_id','&reg_no') new 2: values('444','d444') SGI’S BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE SHAIKH CAMPUS NEHRU NAGAR BELGAUM Page 12
  • 13. INSURANCE DATABASE 1 row created. SQL> / Enter value for driver_id: 555 Enter value for reg_no: e555 old 2: values('&driver_id','&reg_no') new 2: values('555','e555') 1 row created. SQL> select * from owns; DRIVE REG_NO ----- ---------- 111 a111 222 b222 333 c333 444 d444 555 e555 SGI’S BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE SHAIKH CAMPUS NEHRU NAGAR BELGAUM Page 13
  • 14. INSURANCE DATABASE SQL> commit; Commit complete. SQL> create table participated 2 (driver_id varchar(5),reg_no varchar(10),report_no number(5), 3 damage_amt number(6), 4 foreign key(driver_id) references person(driver_id), 5 foreign key(reg_no) references car(reg_no), 6 foreign key(report_no) references accident(report_no)); Table created. SQL> desc participated; Name Null? Type ------------------------------- -------- ---- DRIVER_ID VARCHAR2(5) REG_NO VARCHAR2(10) REPORT_NO NUMBER(5) DAMAGE_AMT NUMBER(6) SGI’S BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE SHAIKH CAMPUS NEHRU NAGAR BELGAUM Page 14
  • 15. INSURANCE DATABASE SQL> insert into participated 2 values('&driver_id','&reg_no',&report_no,&damage_amt); Enter value for driver_id: 111 Enter value for reg_no: a111 Enter value for report_no: 1 Enter value for damage_amt: 15000 old 2: values('&driver_id','&reg_no',&report_no,&damage_amt) new 2: values('111','a111',1,15000) 1 row created. SQL> / Enter value for driver_id: 222 Enter value for reg_no: b222 Enter value for report_no: 2 Enter value for damage_amt: 10000 old 2: values('&driver_id','&reg_no',&report_no,&damage_amt) new 2: values('222','b222',2,10000) 1 row created. SQL> / Enter value for driver_id: 333 Enter value for reg_no: c333 Enter value for report_no: 3 Enter value for damage_amt: 30000 SGI’S BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE SHAIKH CAMPUS NEHRU NAGAR BELGAUM Page 15
  • 16. INSURANCE DATABASE old 2: values('&driver_id','&reg_no',&report_no,&damage_amt) new 2: values('333','c333',3,30000) 1 row created. SQL> / Enter value for driver_id: 444 Enter value for reg_no: d444 Enter value for report_no: 4 Enter value for damage_amt: 12000 old 2: values('&driver_id','&reg_no',&report_no,&damage_amt) new 2: values('444','d444',4,12000) 1 row created. SQL> / Enter value for driver_id: 555 Enter value for reg_no: e555 Enter value for report_no: 5 Enter value for damage_amt: 50000 old 2: values('&driver_id','&reg_no',&report_no,&damage_amt) new 2: values('555','e555',5,50000) 1 row created. SQL> select * from participated; SGI’S BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE SHAIKH CAMPUS NEHRU NAGAR BELGAUM Page 16
  • 17. INSURANCE DATABASE DRIVE REG_NO REPORT_NO DAMAGE_AMT ----- ---------- --------- ---------- 111 a111 1 15000 222 b222 2 10000 333 c333 3 30000 444 d444 4 12000 555 e555 5 50000 QUERY 1 : UPDATE THE DAMAGE AMOUNT FOR THE CAR WITH A REGISTER NUMBER,IN THE ACCIDENT WITH REPORT NUMBER 12 TO 25000. SQL> SQL> update participated 2 set damage_amt=25000 3 where reg_no='&reg_no'AND report_no=1; Enter value for reg_no: a111 old 3: where reg_no='&reg_no'AND report_no=1 new 3: where reg_no='a111'AND report_no=1 1 row updated. SGI’S BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE SHAIKH CAMPUS NEHRU NAGAR BELGAUM Page 17
  • 18. INSURANCE DATABASE SQL> select * from participated; DRIVE REG_NO REPORT_NO DAMAGE_AMT ----- ---------- --------- ---------- 111 a111 1 25000 222 b222 2 10000 333 c333 3 30000 444 d444 4 12000 555 e555 5 50000 QUERY 2 : ADD A NEW ACCIDENT TO THE DATABASE. SQL> insert into accident 2 values(6,'12-apr-2001','delhi'); 1 row created. SQL> select * from accident; REPORT_NO ACC_DATE LOCATION --------- --------- ---------- 1 01-JAN-01 bgm 2 25-DEC-06 goa 3 12-JUN-03 bgm SGI’S BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE SHAIKH CAMPUS NEHRU NAGAR BELGAUM Page 18
  • 19. INSURANCE DATABASE 4 31-DEC-03 bgm 5 02-JAN-04 goa 6 12-APR-01 delhi 6 rows selected. SQL> select * from accident; REPORT_NO ACC_DATE LOCATION --------- --------- ---------- 1 01-JAN-01 bgm 2 25-DEC-06 goa 3 12-JUN-03 bgm 4 31-DEC-03 bgm 5 02-JAN-04 goa 6 12-APR-01 delhi 6 rows selected. Query 4 : FIND THE TOTAL NUMBER OF PEOPLE WHO OWNED CARS THAT WHERE INVOLVED IN ACCIDENTS IN YEAR 2003 SQL> select count(*) AS Total_No_Of_Persons 2 from person p,accident a,participated d 3 where acc_date like '%03'AND SGI’S BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE SHAIKH CAMPUS NEHRU NAGAR BELGAUM Page 19
  • 20. INSURANCE DATABASE 4 d.driver_id=p.driver_id 5 AND a.report_no=d.report_no; TOTAL_NO_OF_PERSONS ------------------- 2 QUERY 5 : FIND THE NUMBER OF ACCIDENTS IN WHICH CARS BELONGING TO A SPECIFIC MODEL WHERE INVOLVED. SQL> select count(*) AS Total_No_Of_Accident 2 from accident a,car c, participated p 3 where model='&model' AND p.reg_no=c.reg_no AND 4 a.report_no=p.report_no; Enter value for model: i10 old 3: where model='&model' AND p.reg_no=c.reg_no AND new 3: where model='i10' AND p.reg_no=c.reg_no AND TOTAL_NO_OF_ACCIDENT -------------------- 1 SGI’S BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE SHAIKH CAMPUS NEHRU NAGAR BELGAUM Page 20
  • 21. INSURANCE DATABASE SQL> select * from car; REG_NO MODEL YEAR ---------- ----- --------- a111 i10 2006 b222 i20 2010 c333 alto 2002 d444 bmw 2005 e555 audi 2003 ************************* END OF TERM WORK 1************************** SGI’S BELGAUM INSTITUTE OF MANAGEMENT STUDIES [BIMS] DEGREE COLLEGE SHAIKH CAMPUS NEHRU NAGAR BELGAUM Page 21