0% found this document useful (0 votes)
68 views3 pages

DBMS Lab-SQl Part 1

The document provides instructions for performing CRUD operations on tables in a database representing vehicle accident information. It includes creating tables, inserting data, updating a value, and querying the tables to find aggregate information.

Uploaded by

Gayuscribd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views3 pages

DBMS Lab-SQl Part 1

The document provides instructions for performing CRUD operations on tables in a database representing vehicle accident information. It includes creating tables, inserting data, updating a value, and querying the tables to find aggregate information.

Uploaded by

Gayuscribd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CS8481- Database Management Systems Lab

SOLUTION:
i. Specify the primary keys and foreign keys and enter at least five tuples for each relation.
SQL> create table person(driver_id varchar(10),name varchar(10),address
varchar(10),primary key(driver_id));

SQL> create table car(regno varchar(10),model varchar(10),year int,primary


key(regno));

SQL> create table accident(report_number int,accd_date date,location


varchar(10),primary key(report_number));

SQL> create table owns(driver_id varchar(10),regno varchar(10),primary


key(driver_id,regno),foreign key(driver_id) references person(driver_id),foreign
key(regno) references car(regno));

SQL> create table participated(driver_id varchar(10),regno


varchar(10),report_number int,damage_amount int,primary
key(driver_id,regno,report_number),foreign key(driver_id) references
person(driver_id),foreign key(regno) references car(regno),foreign
key(report_number) references accident(report_number));
ii. Update the damage amount for the car with specific regno in the accident with report number 1025.

update participated set damage_amount=30000 where report_number=1025 and


regno='TN5634';

iii. Add a new accident to the database.

insert into participated values('kl56743','KL8956',2906,18500);

iv. Find the total number of people who owned cars that were involved in accidents in the year 2019.
v. Find the number of accidents in which cars belonging Wagon R were involved.

You might also like