Department of Cs & Ai SUBJECT: DBMS Assignment-6 BATCH 7, 8 and 9
Department of Cs & Ai SUBJECT: DBMS Assignment-6 BATCH 7, 8 and 9
Name : Karanraj
Ht no : 2203A51241
Batch : 07
Task 1:
Consider the schema for Movie Database:
Command :
Command :
Command :
Create table MOVIES_1241(Mov_id int primary key, Mov_Title varchar(15), Mov_Year date,
Mov_Lang varchar(10), Dir_id int ,foreign key(Dir_id) references DIRECTOR_1214(dir_id));
MOVIE_CAST (Act_id, Mov_id, Role)
Command :
Command :
Create the above tables by properly specifying the primary keys and the foreign keys.
Enter at least five tuples for eachrelation.
Find the names of the actors who acted in two or more movies.
Command : select distinct a.act_name from ACTOR_1214 a,movie_cast_1241 m where a.act_id=m.act_id group
by a.act_id,a.act_name having count(distinct a.act_name)>=2;
List all actors who acted in a movie before 2000
Find the title of movies and number of stars for each movie directed by RGV.
Command : update RATING_1241 set rev_stars=5 where mov_id in (select mov_id from MOVIES_1241
where dir_id=(select dir_id from DIRECTOR_1241 where dir_name='spielberg'));
List all the movies directed by any director which have four star rating
List the names of the directors who directed five star rating movies
List the names of the movies acted by tom hanks and Johnny depp
Task 3:
Consider the following schema for a Library Database:
BOOK (Book_id, Title, Publisher_Name, Pub_Year)
Create the above tables by properly specifying the primary keys and the foreign keys.
Enter at least five tuples for eachrelation.
1. Retrieve details of all books in the library – id, title, name of publisher etc.
2. Get the particulars of borrowers who have borrowed more than 3 books
3. Delete a book in BOOK table.
4. Display the names of the books that have more than 100 copies in the library
5. Display the list of all books and its number of copies that are currently available in the Library.
6. List the names of the books that are barrowed with a publisher name McGraw Hill
7. List the authors of the books published in year 2020 and 2021
8. List the titles of the books borrowed between 01/06/2021 and 10/06/2021
9. Display the names of the books that have at least one copy in the library