Professional Documents
Culture Documents
This Study Resource Was: RACHIT BHALLA - 16BIT0218 (EXAM044)
This Study Resource Was: RACHIT BHALLA - 16BIT0218 (EXAM044)
1. Create tables identifying the primary keys and foreign keys, Insert necessary tuples into the
tables.
m
er as
Enter user-name: EXAM044@SITEORA
co
eH w
Enter password:
o.
Connected to:
rs e
ou urc
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
o
aC s
0),Shelf varchar(10));
varchar(10));
is
ue_Date date);
SQL> alter table Book_Author add constraint Acc_Nofk foreign key(Acc_No) referen
ces Book(Acc_No);
This study source was downloaded by 100000807485648 from CourseHero.com on 11-14-2021 23:06:25 GMT -06:00
https://www.coursehero.com/file/59606897/DBMS-Lab2pdf/
SQL> alter table Issue_Record add constraint Idfk foreign key(Id) references Mem
ber(Id);
ences Book(Acc_No);
(a)Write constraints to insert only stack or reference to Book (shelf) and student or staff to Member
(type).
SQL> alter table Book add constraint ch_slf check (Shelf in('stack','reference'));
SQL> alter table Member add constraint ch_type check (Type in('student','staff'));
m
er as
co
(b) Display the author names of all book where the last letter of the name is e.
eH w
o.
SQL> select Author_Name from Book_Author where Author_Name like '%e';
rs e
ou urc
AUTHOR_NAME
--------------------
o
Kankie
aC s
vi y re
(d) Display the acc_no of all the books which is having due_date in between January 2007 and December
2007.
This study source was downloaded by 100000807485648 from CourseHero.com on 11-14-2021 23:06:25 GMT -06:00
https://www.coursehero.com/file/59606897/DBMS-Lab2pdf/
SQL> select Acc_No from Issue_Record where Due_Date between '01-Jan-2017' and '31-Dec-2017';
ACC_NO
--------- ------
1001
m
er as
co
eH w
o.
rs e
ou urc
o
aC s
vi y re
ed d
ar stu
is
Th
sh
This study source was downloaded by 100000807485648 from CourseHero.com on 11-14-2021 23:06:25 GMT -06:00
https://www.coursehero.com/file/59606897/DBMS-Lab2pdf/
Powered by TCPDF (www.tcpdf.org)