Professional Documents
Culture Documents
Inf2603 202 2024
Inf2603 202 2024
Databases 1
INF2603
Year Module
ASSIGNMENT 02
School of Computing
IMPORTANT INFORMATION:
This tutorial letter contains important information
about your module.
Assignment 02 Questions TOTAL MARKS: 100
2
INF2603/202/0/2024
a. The following exercise is based on the records of the company that stores information
about their sessions (for Sports Physical Therapy). A session record will have a unique
number, session date, patient number, length of the session, therapist number, and
therapy code. Sports Physical Therapy.
Determine the functional dependencies that exist in the following table, and then convert
this table to an equivalent collection of tables that are in the 3rd normal form. (10)
Session (SessionNum, SessionDate, PatientNum, LengthOfSession, TherapistID,
TherapyCode, Description, UnitOfTime)
b. Describe what is meant by transitive dependency and describe how this type of
dependency relates to 3NF. Provide an example to illustrate your answer. (10)
NOTE: All SQL syntax must be correct, missing characters will be penalized!
BTEE Adventure Tours is a small business that organizes daylong, guided trips to South Africa. To support the
company’s growing business, management uses a database to ensure that the company’s data is current,
accurate, and easily accessible.
The owner of Colonial Adventure Tours knows that being able to run queries is one of the most important
benefits of using a DBMS. Use SQL commands to answer the following exercises, you will use the data in the
Colonial Adventure Tours database shown in the below figures:
Figure 4.1 presents sample trip data for BTEE Adventure Tours. Each trip is identified by a unique number called
TripID. Furthermore, management tracks the trip name, the trip’s starting location, and the province in which the
trip originates. In addition, management records the trip’s total distance (in KMs), the trip’s maximum group size,
the trip’s type, and the season of the year.
3
8 Njomane Mount Canoeing Mpumalanga 15 6 Paddling Summer
The table named Reservation shown in Figure 4.2 shows the sample of reservation data for BTEE Adventure
Tours. Each reservation is identified by a unique reservation number that uses the last 2 digits of the current year
followed by a three-digit number that increments sequentially. The table shows the TripID, date, number of
persons, price per person, and other related information.
a. Write the SQL code to list the name of each trip that does not start in KZN. (3)
b. Write the SQL code to list the name and start location for each trip that has the type
Biking. (2)
c. Write the SQL code to list the name of each trip that has the type Hiking and that has a
distance greater than twenty kilometers. (4)
d. Write the SQL code to list the name of each trip that has the type Paddling or that is
located in Mpumalanga. (4)
e. Write the SQL command that calculates how many trips have a type of Paddling or Biking.
(6)
f. Write the SQL code to list the trip name and province for each trip that occurs during the
summer season. Sort the results by trip name within the same province. (4)
g. How many reservations include a trip with a price that is greater than R2000.00 but less
than R35000.00? (5)
h. Write the SQL code to delete table RESERVATION from the database. (2)
©
UNISA 2024