Lab 6 Database
Lab 6 Database
INFORMATICS
NAME:
NO. MATRIC:
S60525
GROUP:
K1
LECTURER:
1.1 Activity 1
1.1.1 Objective
1. Creating a table based on pre-defined data dictionary.
2. Insert a sample of records into respective tables.
Task 1
Create a Entity Relationship Diagram (ERD) for this scenario.
Task 2
Create a table based on data dictionary and apply all business rules stated in the requirements,
and referential integrity for related entities.
Task 3
Create a record for each table based on data provided in Table 2.
AIRPORT 1
AIRPLANE 1
FLIGTH 3
PROFILE 4
FLIGTHDETAILS 5
BOOKING 6
1.2 Activity 2
1.2.1 Objective
Perform query using aggregate functions.
Summarise records based on category.
Using HAVING clause to restrict the summary of records.
1.2.2 Problem Description
Using SQL data manipulation command (DML), complete the following requirements;
1. Find the number of airport that originated from Malaysia. Rename the output as
TotalMalaysiaAirport.
2. Find the number of AirAsia flight departure from 05 June 2016 to 15 August 2016 and
booking status is confirmed.
3. Display the maximum and minimum price ticket for all airline for booking date from 01 April
to 15 Sept 2016 for Malaysia Airlines.
4. Retrieve airport code, airport name, number of flight and average flight duration for all
airport order by airport name in ascending order.
5. Display profile id, profile name, his state and the frequent passenger flies for passenger who
make more than one booking.
6. Display passenger id, name, total amount ticket price booked by every passenger where the
total amount of ticket price is exceeded the average ticket price offered by Air Asia airlines.
Lab Exercises
Objective
Construct Entity Relationship Diagram (ERD) for specific problem.
Using DML command to summarise the records in multi tables queries.
Problem Description
The ABC Research Corporation organise a research conference annually with the colloboration
with two (2) others research company. The company plans to create database application
based on the following entities and attributes;
Organiser – organiser id, name, address, postcode, state, contact person, contact number and
email address.
Conference – conference id, name, conference date, year, conference theme, venue
Venue – venue id, venue name, address (street, city, state, post code)
Participant – participant id, name, designation, company, fees
Each conference consists of parallel session. The business rules for the application are;
Conference venue will rotate among these three companies for every two (2) years.
A total of 40 participants are allow to attend and present the papers in each conference based
on the first come first serve basis.
Charges for professional is RM3000.00, educator is RM2500.00 and for postgraduate student
is RM2000.00.
Participant id is automatically generated by the system with running number starting from
10001
Task 1
Draw an initial and final ERD diagram for this case study.
Task 2
Based on the final ERD, create a table for each entities by applying referential integrity and all
the requirements stated in the a table. You should include SQL script and the print screen
output of creating a table in your answer.
ORGANISER
CONFERENCE
VENUE
PARTICIPANT
EVENTDETAILS
CONFERENCE DETAILS
Task 3
Insert the minimum FIVE (5) records for all tables.
ORGANISER
VENUE
CONFERENCE
PARTICIPANT
CONFERENCE DETAILS
EVENT DETAILS
Task 4
Using Data Manipulation Language (DML) command, complete the following tasks;
1. Summarise organiser name, conferenceid and the number of participant attend for each
conference. You output must be sorted by organiser name as ascending order.
2. List the company, total fees paid for the conference take place in year 2008, 2010 and 2016.
3. Find venue name where more than one conference held at this. You should display venue
name, no_of_conference and total fees paid.
4. Display conferenceid, conference name, conference year and no of session held for all
conferences organised by organiser with id 100 for conference year 2003 and 2015. Your ouput
must group by conference id, conference name and conference year.
5. Find the conference id, conference name and maximum fees paid by participants who attend
the conference for conference code DSC2010 and IOTC2016. You should use INNER JOIN
clause
and USING clause for producing the output for this query.
6. Display participant id, participant name, no of frequent he/she attending the conference that
organised at Kuala Lumpur, Langkawi and Penang. Sort you result by no of frequent as
descending order.