ISYS224 Database Systems : Assignment 1 — Relational Database Design & Implementation

profileaks198
relational_database_design.docx

MACQUARIE UNIVERSITY

Faculty of Science

Department of Computing

ISYS224 Database Systems

2014 - Semester 2

Assignment 1 — Relational Database Design & Implementation (worth 20%)

Important Note:

You are required to submit an electronic copy to ilearn as well as a hard copy of your assignment to the assignment box allocated in the ground floor of E6A by the due date.

Task Specifications

1. Task 1 (10 marks) – Logical Database Schema Design

Based on the following provided sample solution for the diagnostic assignment, turn it into relational database schema indicating primary key for each table and foreign key if there is any in each table and the primary key that it refers to in another table.

(Note: the figure is small, please enlarge it on the screen or print it)

2. Task 1 [10 marks]-Normalization & DDL

Look into the data provided in excel

1. List all the functional dependencies

2. Identify all the candidate keys.

3. Which normal form is this in?

4. Convert from INF to BCNF (Show the conversion from one NF to another along with the dependencies)

5. Create tables based on your normalized form[ in Oracle-SQL developer]

3. Task 2 [10 marks]-SQL Queries

1. Write a SQL query that displays the CinemaID, CinamaName and email of Cinema that have more than 2 branches or a branch in the Suburb of ‘Greyjoy’

2. Write a SQL query that displays BranchAddress, CinemaName and PhoneNumber of the branch that has postcode that starts with 2 or 6

3. Write a SQL query that displays CinamaName, BranchAddress, Session Date(dd-month-yyyy format), Movie StartTime and date where any French movie is being screened. Sort the result by CinemaName descending

4. Write a SQL query that displays CinamaName, BranchAddress, ScreenName, MovieName, YearReleased and Language that screens either a Spanish Movie or a German movie in afternoon or evening session

5. Write a SQL query that displays CinamaName, BranchAddress and the number of screens that are scheduled to screen ‘The Hundred-Foot Journey’

has

has

holds

shown in

rostered in

employs

makes

belong to

is a

makes

belongsto

has

Movies

MovieID

MovieName

Year

Language

Classification

Production

MovieLengthMinutes

<pi>Variable characters (5)

Text (45)

Number (2)

Text (20)

Variable characters (10)

Text (35)

Number (3)

<M>

Cinemas

CInemaID

CinemaName

Email

PhoneNumber

WebsiteURL

<pi>Variable characters (5)

Text (20)

Variable characters (30)

Number (10)

Variable characters (35)

<M>

Customer

CustomerID

CustomerName

CustomerAddressSt

CustomerAddressSuburb

CustomerPostCode

CustomerPhone

<pi>Variable characters (5)

Text (25)

Variable characters (40)

Text (20)

Number (4)

Number (10)

Membership

MembershipID

MembershipName

MemberDiscountPercentage

MonthlyFee

<pi>Variable characters (5)

Text (25)

Number (2)

Decimal (2,2)

<M>

Employee

EmployeeID

EmployeeName

EmployeeAddressSt

EmployeeAddressSuburb

EmployeePostCode

<pi>Variable characters (5)

Text (25)

Variable characters (40)

Text (20)

Number (4)

<M>

Screen

ScreenID

ScreenName

NoofSeats

<pi>Variable characters (5)

Text (30)

Number (2)

<M>

Member

EmailAddress

CreditCardDetails

MembershipID

Variable characters (5)

Number (10)

Variable characters (5)<M>

Branch

BranchID

BranchName

BranchAddressSt

BranchAddressSuburb

BranchPostCode

BranchPhone

<pi>Variable characters (5)

Text (25)

Variable characters (40)

Text (20)

Number (4)

Number (10)

<M>

Session

SessionID

Date

StartTime

<pi>Variable characters (5)

Date

Time

<M>

Booking

BookingID

SessionID

CustomerID

BookingDate

Cost

Discount

<pi>Variable characters (5)

Variable characters (5)

Variable characters (5)

Date

Decimal (2,2)

Decimal (2,2)

<M>

<M>

<M>

<M>

Seats

SeatNoVariable characters (3)<M>