0% found this document useful (0 votes)
2 views1 page

Lab 6 - Implementation in MySQL

The lab focuses on familiarizing students with MySQL/Oracle Database Management Systems by defining relations and constraints. It includes tasks such as identifying foreign keys, explaining integrity rules, creating tables with specific constraints, and entering sample data using SQL commands. Students are required to demonstrate their understanding of relational integrity through practical implementation.

Uploaded by

plutoagcorp
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)
2 views1 page

Lab 6 - Implementation in MySQL

The lab focuses on familiarizing students with MySQL/Oracle Database Management Systems by defining relations and constraints. It includes tasks such as identifying foreign keys, explaining integrity rules, creating tables with specific constraints, and entering sample data using SQL commands. Students are required to demonstrate their understanding of relational integrity through practical implementation.

Uploaded by

plutoagcorp
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/ 1

Department of Computer Science

CSI481 Database Systems

Lab 6 – Implementation Using MySQL or Oracle

Aim
______________________________________________________________________________
The aim of this lab is to continue to familiarise you with the MySQL/Oracle Database
Management System, enabling you to define relations and constraints and populate a database.

Your Tasks
____________________________________________________________________________

Part 2 - MySQL: Specifying Integrity Constraints

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, hotelno) forms the primary key; Booking contains details of bookings
and (hotelno, guestno, datefrom) forms the primary key; Guest contains guest details and guestno
is the primary key.

a) Identify the foreign keys in this schema. Explain how the entity and referential integrity
rules apply to these relations.
b) Produce some sample tables (data) on paper for these relations that observe the
relational integrity rules. Suggest some general constraints that would be appropriate for
this schema.

2. Do the following using the relational schema from 1.


a) Create the Hotel table using SQL in MySQL/Oracle. Note the SQL query.
b) Now create the Room, Booking, and Guest tables with the following constraints:
i. Type must be one of ‘Single’, ‘Double’, or ‘Family’.
ii. Price must be between P100 and P1000.
iii. roomno must be between 1 and 100.
iv. datefrom and dateto must be greater than today’s date.

c) Provide some sample data and enter the data using SQL DML commands. Note the
queries.

You might also like