DBMS Practical 1
DBMS Practical 1
DBMS Practical 1
DBMS PRACTICAL-1
Relational Data:
Q1: SQL statement to create the table LibraryBook?
Ans: Create table LibraryBook (Accession_Number int, Title varchar(100), Author
varchar(50), Department varchar(50), Purchase_Date date, Price int);
Q3: SQL statements to insert all records in the table LibraryBooks provided as data?
Ans: insert into LibraryBook values (10004, 'FUNDAMENTAL OF DATABASE
SYSTEM', 'KS NAVATHE', 'CS', '01-JAN-1998', 675);
insert into LibraryBook values (1102, 'DISCRETE MATHEMATICS', 'O LEVIN',
'MATHS', '19-DEC-2000', 449);
insert into LibraryBook values (1010, 'DATABASE SYSTEM CONCEPTS', 'PROB',
'CS', '02-FEB-1996', 504);
insert into LibraryBook values (2006, 'NEUROLOGY CLINICAL PRACTICAL', 'AK
NAVATHE', 'MEDICINE', '01-JAN-2004', 209);
insert into LibraryBook values (39910, 'SOFTWARE ENGINEERING', 'KK
AGGARWAL', 'CS', '28-FEB-2001', 198);
insert into LibraryBook values (789, 'ORGANIZATIONAL BEHAVIOR', 'S
ROBBINS', 'MANAGEMENT', '09-AUG-1990', 880);
Q4: SQL statements to insert all records in the table IssuedBooks provided as data?
Ans: insert into IssuedBooks values (1002, 'PUNEET');
insert into IssuedBooks values (39910, 'ARVIND');
insert into IssuedBooks values (2006, 'BINEET');
Q7: Change the Department of the book titled “Discrete Maths” to “CS”?
Ans: update LibraryBooK set DEPARTMENT='CS' where TITLE='DISCRETE
MATHEMATICS';
Q9: List all books that belong to “CS” department and are written by author “Navathe”?
Ans: select * from LibraryBook where DEPARTMENT='CS' and AUTHOR like
'%NAVATHE%';
Q11: List all books which have a price less than 500 or purchased between
“01/01/1999” and “01/01/2004”?
Ans: select * from Library_Book where PRICE < 500 or PURCHASE_DATE between
'01-JAN-1999' and '01-JAN-2004';