Dbms Printout
Dbms Printout
Consider the Insurance database given below. The primary keys are underlined and the
data types are specified.
(i) Create the above tables by properly specifying the primary keys and the
foreign keys.
(ii) Enter at least five tuples for each relation.
(iii) Demonstrate how you
a. Update the damage amount for the car with a specific Regno in the
accident with report number 12 to 25000.
b. Add a new accident to the database.
(iv) Find the total number of people who owned cars that were involved in
accidents in 2008.
(v) Find the number of accidents in which cars belonging to a specific model were
involved.
(vi) Generate suitable reports.
(i) Create the above tables by properly specifying the primary keys and the foreign keys.
---------- ---------------
-------
ka03hh7014 sxi-dlx 2009
ka02eh5590 i20 2010
ka03k1234 fiat 1990
mh12p6969 ferrari 2008
rj02m0755 gypsy 2009
DRIVER_ID REGNO
---------- ----------
a101 ka03hh7014
a102 mh12p6969
a103 rj02m0755
a101 ka03k1234
a102 ka02eh5590
(iv) Find the total number of people who owned cars that were involved in accidents in
2008.
Consider the following relations for an order processing database application in a company.
ORDER (order #: int, odate: date, cust #: int, ord-Amt: int) ITEM
(i) Create the above tables by properly specifying the primary keys and
the foreign keys. (ii) Enter at least five tuples for each relation.
(iii) Produce a listing: CUSTNAME, #oforders, AVG_ORDER_AMT, where the
middle column is the total numbers of orders by the customer and the
last column is the average order amount for that customer.
(iv) List the order# for orders that were shipped from all the warehouses that the
company has
in a specific city.
(v) Demonstrate the deletion of an item from the ITEM table and
demonstrate a method of handling the rows in the ORDER_ITEM table that
contain this particular item.
(vi) Generate suitable reports.
(i) Create the above tables by properly specifying the primary keys and the foreign keys.
WAREHOUSE_NO CITY
------------ ----------
1500 bangalore
1550 orissa
1600 paradeep
1650 vishak
1700 bangalore
(iv) List the order# for orders that were shipped from all the warehouses that the
company has in a specific city.
ORDER_NO CITY
--------- ----------
501 bangalore
568 bangalore
502 bangalore
(v) Demonstrate the deletion of an item from the ITEM table and demonstrate a
method of handling the rows in the ORDER_ITEM table that contain this
particular item.
description:string)
(i) Create the above tables by properly specifying the primary keys and the
foreign keys. (ii) Enter at least five tuples for each relation.
(iii) Give the details of the authors who have 2 or more books in th e catalog and
the price of the books is greater than the average price of the books in the
catalog and the year of publication is after 2000.
(iv) Find the author of the book which has maximum sales.
(v) Demonstrate how you increase the price of books published by a specific
publisher by 10%. (vi) Generate suitable reports.
(i) Create the above tables by properly specifying the primary keys and the
foreign keys.
Table created.
CATEGORY_ID DESCRIPTION
----------- ----------
11 oops
12 networks
13 dbms
14 sys soft
15 java
SQL> insert into catalog values(900,'com nw',101,660,13,2009,667);
1 row created.
NAME
-ANIL
(v) Demonstrate how you increase the price of books published by a specific publisher by
10%.
2 rows updated.
(i) Create the above tables by properly specifying the primary keys and the foreign
keys
(ii) Enter at least five tuples for each relation
(iii) Find all the customers who have at least two accounts at the Main branch.
(iv) Find all the customers who have an account at all the branches located in a
specific city.
(v) Demonstrate how you delete all account tuples at every branch located in a
specific city.
(vi) Generate suitable reports.
i) Create the above tables by properly specifying the primary keys and the foreign keys
CUST_NAME ACCNO
---------- ---------
anil 19901
amit 78231
manish 19956
abhinav 23856
anil 19956
(iii) Find all the customers who have at least two accounts at the Main branch.
SQL> select distinct d.cust_name from depositor d where accno in (select a.accno from
account a where br_name in(select br_name from branch where br_city='bangalore'));
CUST_NAME
---------
anil
manish
(v) Demonstrate how you delete all account tuples at every branch located in a specific city.
SQL> delete from depositor where accno in(select accno from account a,branch
b where a.br_name=b.br_name and br_city='bangalore');
4 rows deleted.
SQL> delete from account where br_name in(select br_name from branch where
br_city='bangalore');
3 rows deleted.
(vi) Generate suitable reports.
SQL> select c.cust_name,a.accno,c.cust_strt from cust_det c,account
a,depositor d where(a.accno=d.accno);
CUST_NAME ACCNO CUST_STRT
---------- --------- ----------
anil 23856
park strt
amit 23856
palika
ankit 23856 kundanhali
manish 23856 v
ignan
abhinav 23856 m
onikola