Advanced DBMS Concepts Practical
Advanced DBMS Concepts Practical
PPR
RAAC
CTTIIC
CAALLSS IIN
NAAD
DVVA
ANNC
CEED
DDDA
ATTA
ABBA
ASSEESS
1. Assume we have a global conceptual schema that contains the following table with the
key underlined: Employee(Eno,Ename,Title,Dno). Also assume that we horizontally
fragment the table as follows:
2. We are given the following three relations with their keys underlined:
Supplier( Sno,Sname,City,State)
Part( Pno,Pname,Color)
Supplier-Part( Sno,Pno,Qty).
We know that Suppliers can supply many Parts and many Suppliers can supply a Part.
Assume the Supplier table is horizontally fragmented using the predicates: State =
Maharashtra and State = Karnataka. We can also assume that Suppliers are evenly
located in only those two states. In addition, the Part table is horizontally fragmented
using the predicates: 1 £ Pno £ 100,101 £ Pno £ 200, 201 £ Pno £ 300, 301 £ Pno £
400, 401 £ Pno £ 500. Part numbers are continuous from 1 to 500, inclusive.
Now we are to horizontally fragment the Supplier- Part relation according to your
choice. Implement at least 5 suitable queries using oracle 9i.
3. The Oracle user Amar owns a database table named CarDealers. The table
contains some user-defined (complex) data types as attributes.
a. Identify the structure of the table CarDealers as well as the structure of all
its subcomponents (attributes). In order to identify the components
(attribute names and data types), use only queries against views of the
Oracle Data Dictionary. Give all SQL queries you state against the data
dictionary in order to obtain the information. Give also the result of each
query.
b. Create exactly the same table in your schema using Oracle9i-SQL. That
create the appropriate user-defined types first, and finally the table
[email protected]
Sushil Kulkarni 2
d. Formulate a query against the table CarDealers owned by the user Amar.
The query has to list the names of car dealers who offer silver “ icon”. Data
dictionary views specific to object-relational features in Oracle9i.
Now,
[email protected]
Sushil Kulkarni 3
AUTHOR(name, addr:<pincode,street,city,state,no>)
That is, address is the name of an object-valued attribute, which has five components.
Queries:
a) List all of the authors that have the same address as their publisher:
select a.name
from authors a, publishers p
where a.addr = p.addr;
b) List all of the authors that have the same pincode as their publisher:
select a.name
from authors a, publishers p
where a.addr.zipcode = p.addr.pincode;
d) List the title of the book that has the most authors:
Select title
from books b, table(b.authors)
group by title
having count(*)
=
(select max(count(*))
from books b, table(b.authors)
group by title);
[email protected]
Sushil Kulkarni 4
In the first query, the list of authors for each book is unnested and tuples are
grouped by title (e.g., if a book has 5 authors, then there will be five tuples that
have the same title). Only the book that has the most authors is select (using the
having clause).
e) List the name of the publisher that has the most branches:
Select p.name
from publishers p, table(p.branches)
group by p.name having count(*)> =
all (select count(*)
from publishers p, table(p.branches)
group by name);
select a.name
from authors a
where not exists(
select b.title
from books b, table(select authors
from books b1
where b.title = b1.title) a2
where a.name = name);
or
select a.name
from authors a
where not exists( select b.title
from books b, table(b.authors)
where a.name = name);
h) Move all the branches that belong to the publisher 'LittleHouse' to the publisher
‘‘PubHouse'
i) List all authors who have published more than one book:
select a.name
from authors a, books b, table(b.authors) v
where v.column_value = ref(a)
group by a.name having count(*) > 1;
[email protected]
Sushil Kulkarni 5
j) Name of authors who have published books with at least two different publishers?
k) List all books (title) where the same author appears more than once on the list of
authors (assuming that an integrity constraint requiring that the name of an author
is unique in a list of authors has not been specified).
5. a. Create a table that contains at least one attribute of an image. Add at least 10
tuples in the table and write query to invoke a particular image.
b. Create a table that contains at least one attribute of an audio. Add at least 10
tuples in the table and write query to invoke a particular audio.
c. Create a table that contains at least one attribute of a video. Add at least 10 tuples
in the table and write query to invoke a particular video.
6. Create a table using Time DB to store data along with valid, transaction time and issue
at least 3 queries on it.
7. Create a table that store the special data and issue at least 3 queries
8. Formulate a database using active rules using row and statement level that include
STARTBUST notation.