0% found this document useful (0 votes)
4 views5 pages

Dbms Assignment 1

data base

Uploaded by

047 Nadir Johar
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)
4 views5 pages

Dbms Assignment 1

data base

Uploaded by

047 Nadir Johar
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/ 5

Jamia Hamdard

Department of Computer Science &


Engineering
School of Engineering Science & Technology,
New Delhi - 110080

Database Management Systems

(Assignment 1)
B.Tech. (CSE) A.I.
3rd Year, 5th Sem.

Summitted by: Summitted to:


Nadir Johar Dr. Anil Kumar Mahto
2020-350-047
Assignment-1
A. Consider the following schema for a Library Database:
BOOK (Book_id, Title, Publisher_Name, Pub_Year)

BOOK_AUTHORS (Book_id, Author_Name)

PUBLISHER (Name, Address, Phone)

BOOK_COPIES (Book_id, Branch_id, No_of_Copies)

BOOK_LENDING (Book_id, Branch_id, Card_No, Date_Out, Due_Date)

LIBRARY_BRANCH (Branch_id, Branch_Name, Address)

 Create tables with the details shown above


create table book(book_id char(5),title varchar(5),publisher_name varchar(5),pub_year int)

create table book_authors(book_id char(5),author_name char(10))

create table publisher(name char(10),address char(20),phone int)

create table book_copies(book_id char(5),branch_id char(5),no_of_copies int)

create table book_lending(book_id char(5),branch_id char(5),card_no int,date_out date,due_date


date)

create table library_branch(branch_id char(5),branch_name char(10),address char(20))

 Insert five tuples in each table.


Table book

insert into book values('1','t1','pub1',1950)

insert into book values('2','t2','pub2',1949)

insert into book values('3','t3','pub3',1951)

insert into book values('4','t4','pub4',1950)

insert into book values('5','t5','pub5',1947)

Table book_authors

insert into book_authors values('1','auth1')

insert into book_authors values('2','auth2')

insert into book_authors values('3','auth3')

insert into book_authors values('4','auth4')

insert into book_authors values('5','auth5')


Table publisher

insert into publisher values('pub1','add1',9876543210)

insert into publisher values('pub2','add2',9876543211)

insert into publisher values('pub3','add3',9876543212)

insert into publisher values('pub4','add4',9876543213)

insert into publisher values('pub5','add5',9876543214)

Table book_copies

insert into book_copies values('1','11',10)

insert into book_copies values('2','12',11)

insert into book_copies values('3','13',12)

insert into book_copies values('4','14',13)

insert into book_copies values('5','15',14)

Table book_lending

insert into book_lending values('1','11',1000,'02-08-2022','08-08-2022')

insert into book_lending values('2','22',1001,'06-09-2022','06-24-2022')

insert into book_lending values('3','33',1002,'05-03-2022','05-29-2022')

insert into book_lending values('4','44',1003,'03-20-2022','04-08-2022')

insert into book_lending values('5','55',1004,'01-08-2022','02-03-2022')

Table library_branch

insert into library_branch values('1','bname1','add1')

insert into library_branch values('2','bname2','add2')

insert into library_branch values('3','bname3','add3')

insert into library_branch values('4','bname4','add4')

insert into library_branch values('5','bname5','add5')


 Print the details of above created tables
Table book

Select * from book

Table book_authors

Select * from book_authors

Table publisher

Select * from publisher


Table book_copies

Select * from book_copies

Table book_lending

Select * from book_lending

Table library_branch

Select * from library_branch

You might also like