0% found this document useful (0 votes)
50 views

Submit Your Work in Edmodo in 1 Week

The document provides three examples of database schemas and asks to identify the foreign keys in each. [1] The first schema contains tables for hotels, rooms, bookings, and guests. Foreign keys include hotelNo in the Rooms and Bookings tables referring to the primary key in Hotels. [2] The second schema tracks students, courses, enrollments, book adoptions, and textbooks. Foreign keys include Course# and SSN in the Enrollments table referring to primary keys in Courses and Students. [3] The third schema tracks salespeople, trips, and expenses. Foreign keys include SSN in the Trips table and Trip_ID in the Expenses table referring

Uploaded by

wirdina
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

Submit Your Work in Edmodo in 1 Week

The document provides three examples of database schemas and asks to identify the foreign keys in each. [1] The first schema contains tables for hotels, rooms, bookings, and guests. Foreign keys include hotelNo in the Rooms and Bookings tables referring to the primary key in Hotels. [2] The second schema tracks students, courses, enrollments, book adoptions, and textbooks. Foreign keys include Course# and SSN in the Enrollments table referring to primary keys in Courses and Students. [3] The third schema tracks salespeople, trips, and expenses. Foreign keys include SSN in the Trips table and Trip_ID in the Expenses table referring

Uploaded by

wirdina
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

26/10/2017 Oct 2017

BMIS 32113 Database


Tutorial Lecture 4 (i)

1. The following tables form part of a database held in a relational DBMS:

Hotel (hotelNo, hotelName, city)


Room (roomNo, hotelNo, type, price)
Booking (hotelNo, guestNo, dateFrom, dateTo, roomNo)
Guest (guestNo, guestName, guestAddress)

where Hotel contains hotel details and hotelNo is the primary key;
Room contains room details for each hotel and (roomNo, hoteINo) forms the primary key;
Booking contains details of bookings and (hoteINo, guestNo, dateFrom) forms the primary key;
Guest contains guest details and guestNo is the primary key.

Identify the foreign keys in this schema. Explain how the entity and referential integrity rules apply
to these relations.

2. Consider the following relations for a database that keeps track of student enrollment in courses
and the books adopted for each course:

STUDENT (SSN, Name, Major, Bdate)


COURSE (Course#, Quarter, Grade)
ENROLL (SSN, Course#, Quarter, Grade)
BOOK_ADOPTION (Course#, Quarter, Book_ISBN)
TEXT (Book_ISBN, Book_Title, Publisher, Author)

Specify the foreign keys for this schema, stating any assumptions you make.

3. Consider the following relations for a database that keeps track of business trips of salespersons in a
sales office:

SALESPERSON (SSN, Name, Start_Year, Dept_No)


TRIP (SSN, From_City, To_City, Departure_Date, Return_Date, Trip_ID)
EXPENSE (Trip_ID, Account#, Amount)

Specify the foreign keys for this schema, stating any assumptions you make.

Submit your work in Edmodo in 1 week.

You might also like