Accessionnumber Title Author Department Purchasedate Price
Accessionnumber Title Author Department Purchasedate Price
Create a database having two tables with the specified fields, to computerize a library system of a
Delhi University College.
(a) Identify primary and foreign keys. Create the tables and insert at least 5 records in each table.
Answer 1.
(a) create table LibraryBooks ( AccessionNumber int , Title varchar (50) , Author varchar (20) ,
Department varchar (20) , PurchaseDate date , Price int ) ;
insert into LibraryBooks values ( 10004 , 'Fundamentals of Database System' , 'Navathe' , 'CS' , '01-
Jan-1998' , 675 ) ;
insert into LibraryBooks values ( 1002 , 'Discrete Mathematics' , 'O.Levin' , 'Maths' , '19-Dec-2000' ,
449 ) ;
insert into LibraryBooks values ( 1010 , 'Database System Concepts' , 'P.Rob' , 'CS' , '02-Mar-1996' ,
504 ) ;
insert into LibraryBooks values ( 2006 , 'Nuerology in Clinical Practice' , 'Navathe' , 'Medicine' , '01-
Jan-2004' , 209 ) ;
insert into LibraryBooks values ( 39910 , 'Software Engineering' , 'KK Aggarwal' , 'CS' , '28-Feb-2001' ,
198 ) ;
insert into LibraryBooks values ( 789 , 'Organisation Behaviour' , 'S Robins' , 'Management' , '09-Aug-
1990' , 800 ) ;
ACCESSIONNUMBER BORROWER
2006 Bineet
1002 Puneet
39910 Arvind
(c) Change the Department of the book titled “Discrete Maths” to “CS”.
(e) List all books that belong to “CS” department and are written by author “Navathe”.
g) List all books which have a price less than 500 or purchased between “01/01/1999” and
“01/01/2004”
select * from LibraryBooks where price < 500 or purchasedate between '01-Jan-1999' and '01-Jan-
2004' ;