Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Data Management

Major Project
100 Marks
Worth 20%
Due in week 15
Data Management Major Project

Business Rules

A vehicle rental company asked you to develop a database system to keep records of the company’s different
vehicles that is owns. After doing an interview with most of the staff working there you come up with the
following business rules which will help you build your database system for the vehicle rental company.

- Information about the vehicle must be kept like the make, model, registration number, safety sticker,
color, available and comments. Each vehicle must be uniquely identified by a vehicle id.
- Also information about the customers must also be kept like the customer’s first name, surname,
gender, profession, phone, email and address. Each customer must be uniquely identified by a
customer id.
- Information about drivers must also be kept because sometime customer want a driver with the
vehicle in case they do not know how to drive. Driver information like first name, surname, gender,
phone, email, address must be kept. Every driver must be identified by a driver’s id number.
- The company has different branches throughout the country so information about the different
branches must also be kept like the branch name, branch location. Each branch must be identified by a
branch code.
- The database must also have a table to store information about the users of the system. This table will
have info like the user’s first name, surname, user type, username, and password. (The user table will
not be linked to any other table)
- The manager want to also keep a log of the database secretly in a table called database_logs just to
know who has been modifying what. The table log should have username (user who is doing the
modification), table being modified, and command being used on the table (insert or update or delete),
date and time of modification.

After identifying the different objects that are required to be stored in the database you then collect
information on how they are related.

- One customer can hire one or many vehicles.


- One vehicle can be hired by one or many customers
- One driver can drive many vehicles
- One vehicle can be driven by one or many drivers
- One branch can have one or many vehicles

1|Page International Training Institute


Data Management Major Project

PART A – DATABASE DESIGN

Part A should be typed in Microsoft word. The document should be outlined as follows:
- You should have a cover page with your first name, surname, course and group on the front cover.
- Each question should be typed on a different page.
- Save the word document as PDF with the name Part-A.pdf.

Question 1

List the entities together with their attributes in the notation R(A,B,C,…). Remember to also identify the primary
key attribute when listing each entity by underlining it.

Question 2

Draw the Entity Relationship Diagram of the above using the crows foot notation. (If you come across any many
to many relationship remember to create a third intermediate table and then create two one to many
relationships between the original two tables and the new intermediate table).

Question 3

Expand all tables in your ER Diagram in Question 2 and populate the tables with at least three records each and
normalize all your tables to third normal form starting from first Normal Form to Second Normal Form then to
Third Normal Form.

NOTE:
During Normalization if new tables are created then you must redraw your ER diagram on another page and
the new ER Diagram must show the new tables as well. However if there are no new tables created in the
process of Normalization then no need to re-draw your ER Diagram.

2|Page International Training Institute


Data Management Major Project

PART B – MySQL
Question 1 (Creating the Database)

Write SQL statements to create the above database on a notepad and save it as database.txt

Question 2 (Creating Views)

Write SQL statements to create the following views on a notepad and save it as views.txt:

i) Create a view called hired_vehicles to show the vehicles that are currently hired by customers
(this view should consist of columns from the vehicle table and customer table as well).
ii) Create a view called available_vehicles to show that vehicles that are not hired and are
available for hiring (this view should consist of columns from the vehicle table and the customer
table where the column available in the vehicle table is set to “No”).
iii) Create a view called branch_total_vehicles that will show all the branches and how many
vehicles are in each branch (Use GROUP BY clause and COUNT function to achieve this) columns
will come from the branch table and the vehicle table.

Question 3 (Functions)

Write SQL statements to create the following functions on a notepad and save it as functions.txt.

i) Create a function to create the username for users. Call this function username. The function
will take in two string parameters, the first being the first name and the second being the
surname. After processing the two strings the function should return the first letter of the first
name concatenated (joined) with the surname.

Example: SELECT username(“Sally”, “Luke”) = sluke

ii) Create a function called password1. This function should take in a string and concatenate that
string with four randomly generated numbers to form the passwords for the users.

Example: SELECT password1(“abc”) = abc3452

Here the number 3452 is randomly generated and concatenated with “abc” to form the
password.

3|Page International Training Institute


Data Management Major Project

Question 4 (Creating Triggers)

Write SQL statements to create the following triggers on a notepad and save it as triggers.txt:

i) Create a trigger that fires AFTER INSERT into the driver table it INSERTS INTO the
database_log table the VALUES CURRENT_USER(), “driver”, “INSERT”, NOW().
ii) Create a trigger that fires AFTER UPDATE on the driver table it INSERTS INTO the
database_log table the VALUES CURRENT_USER(), “driver”, “UPDATE”, NOW().
iii) Create a trigger that fires AFTER DELETE FROM the driver table it INSERTS INTO the
database_log table the VALUES CURRENT_USER(), “driver”, “DELETE”, NOW().

Question 5 (Populating the Database)

Finally you must populate your database. Open a notepad and save it at data.txt. Type in SQL
statements to INSERT data into all the tables created. Insert at least five records for each table you
create.

4|Page International Training Institute


Data Management Major Project

Instructions for submitting Project


Step 1:
After completing you project you should have the following files created already:

1) Part A.pdf
2) Database.txt
3) Views.txt
4) Functions.txt
5) Trigger.txt
6) Data.txt

Create a folder and Place all these files inside. Compress this folder into a zipped file. Label that zipped
file using the following naming convention:
<student_id>-<student_firstname>-<student_surname>-<course_group>

Example:
The folder for a student with ID number 1234 and first name Tom and surname Peter who is in POM-
DIT(S1)-D1 should be like this.

1234-Tom-Peter-POM-DIT(S1)-D1.zip

Step 2:
Now upload your files to the ITI Database System under Data Management Subject. Below are the
instructions:
1) Go to the site http://iti-fs1 if you’re in the ITI POM campus, otherwise go to http://app.iti.ac.pg
if you’re at home or anywhere using your phone or laptop and login.
2) Go to the Data Management subject.

3) Then Click on this button and you should see a pop up like what is shown below:

4) Click on the choose file button and select your zipped file and then click the blue upload button.

STRICTLY NO FLASH DRIVES ALLOWED. UPLOAD ALL ASSIGNMENTS USING THE ITI DATABASE SYSTEM

5|Page International Training Institute

You might also like