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

Lab 6 Database

1. The document describes a database lab exercise on summarizing records from multiple tables. It involves creating tables based on an ERD and data dictionary, inserting sample records, and using aggregation functions and grouping to summarize records. Queries must retrieve summarized data such as counts of airports by country, numbers of flights by dates and status, minimum and maximum ticket prices, and more. 2. The second part of the lab describes a conference management database with tables for organizers, venues, participants, and more. Tasks involve drawing an ERD, creating tables, inserting records, and using joins and aggregation to summarize data like organizer names and participant counts by conference, total fees by year and company, and more.

Uploaded by

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

Lab 6 Database

1. The document describes a database lab exercise on summarizing records from multiple tables. It involves creating tables based on an ERD and data dictionary, inserting sample records, and using aggregation functions and grouping to summarize records. Queries must retrieve summarized data such as counts of airports by country, numbers of flights by dates and status, minimum and maximum ticket prices, and more. 2. The second part of the lab describes a conference management database with tables for organizers, venues, participants, and more. Tasks involve drawing an ERD, creating tables, inserting records, and using joins and aggregation to summarize data like organizer names and participant counts by conference, total fees by year and company, and more.

Uploaded by

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

UNIVERSITI MALAYSIA TERENGGANU

FACULTY OF OCEAN ENGINEERING TECHNOLOGY AND

INFORMATICS

CSF3205 DATABASE (LAB 6)

NAME:

MUHAMMAD NIZAR BIN NASEERUTEEN

NO. MATRIC:

S60525

GROUP:

K1

LECTURER:

PROF MADYA DR MOHD POUZI HAMZAH


LAB 6 – Summary the Records
Objectives:
At the end of this lab, the students will be able to:
1. Use aggregate functions.
2. Grouping and summarise the records.
3. Using HAVING clause to restrict summary records.
Scenario 1
ABC Airlines implemented web based Airline Booking System to support the company business
strategic. Before using the system, users are required to create a new user and maintain the
profile data. Once this process done, user can login into the system and make a flight booking
or to view the availaibility of flight or any discount of flight. Data dictionary for the system will
be presented as below;

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.

You might also like