COIT20247 Database Design and Development
Objectives
This assessment item relates to the unit learning outcomes numbers 1, 2 and 3 as stated in the unit profile.
Introduction
The sample solution of assignment 1 will be released on the unit website approximately two (2) weeks after the assignment 1 due date. You must use that sample solution of assignment 1 only for the following tasks:
Assessment task
1 ER Mapping and Normalization
- a) Map the ER diagram, from the sample solution, into a set of relations in at least Third Normal Form (3NF). You must ensure that your relations meet 3NF. There is no need to show your working.
- b) Select any two of your relations from the previous step (1a), and perform the following for each of those two relations:
- List all the functional dependencies exist in the relation.
- Demonstrate that the relation meets Third Normal Form (3NF).
For your help, an example for a Student relation’s 3NF justification has been provided below:
STUDENT (StudentID, Name, Address, DateOfBirth)
- The primary key is StudentID which identifies a student. There will be one student name per Student ID because only one name is recorded for each student. Even though a student may have multiple addresses (e.g. a home address and a work address), the case study states that there is a need to record the home address only and hence there will be only one address for each student. There will be only one date of birth for each student. Thus, there are no repeating groups. Hence, this relation is in 1NF.
- The primary key is StudentID. This is the only candidate key since Name is not guaranteed to be unique (two different students may have the same name). Address is also not guaranteed to be unique. This means that Student ID functionally determines every other attribute in the table. There is a single valued simple candidate key
(StudentId) and therefore no partial dependencies are possible. Hence, the relation is in 2NF.
iii. Name cannot be used to functionally determine any other attribute in the table since two different students may have the same name; likewise for address and date of birth. Therefore there are no transitive dependencies in the table. Therefore it meets the requirements of first, second and third normal form.
2 Use MySQL Workbench to create the logical database model
Consider the E-R model on the flight booking as the solution of assignment 1 released, Use MySQL Workbench 8.0 CE to create a logical database model with the relations as in Part 1(E-R mapping and normalization), include specifying the primary keys, foreign keys, creating relationships as appropriate, and creating the E-R diagram. Save the file as fbdb.mwb
3 Relational database implementation using MySQL Server
Use MySQL Server to perform the physical implementation of the designed database from the above logical model and export the database file as fbdb.sql. In implementing the ER model provided, you must complete the following tasks:
- Create all the relations in a MySQL database. Consider each attribute in every table and make appropriate choices regarding data types & sizes, null allowed or not. Your choices should be appropriate for each attribute and should support data integrity.
- Indexing can speed up search for particular tables or queries. Review the guideline given in the textbook regarding set-up of index. You should at least ensure the last name and phone attributes in the Customer table to be indexed, and the flightNo attribute in the Flight table to be indexed.
- Populate the database with sample data of your own. You must include sufficient sample data to test your queries and report. Please note that the expected result of query questions as below should depend on the actual sample data populated.
You also can implement your database using MySQL Workbench or via Command Line Client. (Note: Week 6 lecture and tutorial provide the instructions how to export a MySQL database file)
Stored procedures
In databases, a stored procedure is a piece of prepared SQL code that you can save, execute and reuse at any time. You are required to write two stored procedures as specified below:
(i) Write a stored procedure that can be used to show the details of each flight between Rockhampton and Brisbane, when it is executed. The details include the flight number, flight date, departure time, arrival time, departure airport, arrival airport and the price.
(ii) Write another stored procedure with a parameter that represents the airport code. When the stored procedure is called, the value of parameter is passed to the procedure. The procedure will display the flights between the Sydney airport to another airport that is parameterized in this procedure.
Information requests
Create queries to answer the following information requests. You should type the query codes manually using SQL view/editor under MySQL Server.
The marking process of the queries for information requests may also consider the effectiveness of your SQL statements that have been used in the queries. It is important that your SQL statement must reflect the correct business logic & SQL syntax. (Use enough sample data so that the output is produced by each and every query. The expected result is under each question. Your result should be in a similar format but may have a different content, depending on the data you populated in your database). Under MySQL Server, save each query question SQL statement as a file such as q1.sql, …, q5.sql
- Obtain a list of Customer ID, first name, last name and contact phone for customers who have flown or will fly on flights that have departed or will depart from Rockhampton.
- List details of booking made for each airline. These details include airline code, reservation ID, flightNo, departure airport, arrival airport as well as the flight date.
- List details of booking made for customers whose travel dates are the dates between 1st December 2020 and 15th December 2020. These details include customer name, reservation ID, flightNo, flight date and total price.
- Find out how many flights of each airline has operated from Brisbane to Sydney from the given data in the table. Your result should include the airline code and corresponding number of flights.
3
- Find out the details of the cheapest prices of flights from Brisbane to Sydney. Your result should include the flightNo, flightDate, departure time, arrival time, and price.
Report
MySQL Server doesn’t come with a native Reporting tool. But it is very easy to create a Report by export the data source of a MySQL database to a third-party utility program (such as phpMyAdmin, dbForgeStudio, and Navicat etc.) or Microsoft Excel. As an exercise, we ask you to export the data source to Excel to create a simple report object showing the details of each flight between Rockhampton and Brisbane. When the data source from MySQL exporting to excel, simply call and execute the first stored procedure as defined in the relational database implementation section on a sheet of the Excel, then import the data (due to the result of executing the stored procedure) to Excel. In addition, add a report header and display the average price of all flights in a cell on the Excel sheet. (Note: when you install MySQL Server, if have not installed the component named mysql-for-excel-1.3.8, you need to download and install it separately. The installer is also available on the moodle course website).
Expert's Answer
Chat with our Experts
Want to contact us directly? No Problem. We are always here for you
Get Online
Assignment Help Services