DOC-20240616-WA0000

You might also like

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

FACULTY OF ACCOUNTANCY OF

UNIVERSITY TECHNOLOGY MARA, ARAU, PERLIS

PREPARED BY:

NAME STUDENT ID GROUP


NUR AMIRA ALYAA BINTI MOHD NASRI 2020868362 RAC1204D
NUR AMIRAH BINTI MOHD NASIR 2020815024 RAC1204D
NURLIYANA ATHIRA BINTI MD FAHMI 2020492108 RAC1204D
NURUL ERISYA SOFEA BINTI RIDUAN 2020824318 RAC1204D

AIS275
DATA MANAGEMENT

PREPARED FOR
DR MARJAN MOHD NOOR

SUBMISSION DATE:
15 JULY 2022
TABLE OF CONTENT
1.0 INTRODUCTION......................................................................................................................................3
2.0 CASE STUDY...........................................................................................................................................4
3.0 ERD NARRATIVE.....................................................................................................................................6
4.0 DATABASE CONCEPTUAL DESIGN...........................................................................................................9
4.1 ENTITY RELATIONSHIP DIAGRAM.....................................................................................................10
4.3 3NF Table Structure.........................................................................................................................11
5.0 DATABASE SYSTEM IMPLEMENTATION.................................................................................................11
5.1 Data Definition Language (DDL).......................................................................................................12
5.1.1 Create table statement.............................................................................................................12
5.1.2 CREATE A SINGLE VIEW TABLE...................................................................................................14
5.1.3. CREATE VIEW MULTIPLE TABLE................................................................................................14
5.1.4. Create view single table (updatable)........................................................................................15
5.1.5. Create view multiple table (updatable)....................................................................................15
5.1.6. Drop table statement...............................................................................................................15
5.1.7. Alter table statement...............................................................................................................15
5.2 Data Manipulation Language (DML)................................................................................................17
5.2.1 Insert Into Table Statement.......................................................................................................17
5.2.2 Insert Into View (updatable).....................................................................................................20
5.2.3 Update Table Statement...........................................................................................................20
5.2.4 Update view (updatable)...........................................................................................................21
5.2.5 Delete table Statement.............................................................................................................21
5.2.6 Select statement with minimum 20 records for all tables.........................................................22
5.2.6.1 Comparison operator.........................................................................................................22
5.2.6.2 Logical operator (AND, OR, NOT)........................................................................................22
5.2.6.3 Special operator (LIKE, BETWEEN, DISTINCT).....................................................................23
5.2.6.4 Arithmetic function (*, /, +, -).............................................................................................23
5.2.6.5 Column function and grouping...........................................................................................24
5.2.6.6 Type 1 Nested queries (IN, NOT, IN)...................................................................................24
5.2.6.7 Type II Nested queries (EXIST, NOT EXIST)..........................................................................25
5.2.6.8 RETRIEVE DATA FROM MULTIPLE TABLE.............................................................................25
5.2.7 SELECT statement for all views..................................................................................................28
6.0 SYSTEM IMPLEMENTATION..................................................................................................................28
6.1 The form and sub form are shown...................................................................................................29
7.0 CONCLUSION.......................................................................................................................................33
8.0 REFERENCES.........................................................................................................................................34
9.0 APPENDICES.........................................................................................................................................35
1.0 INTRODUCTION

To have a deeper understanding of the database conceptual system, database system


implementation, and system implementation, we should complete this assignment. Our
task is to create a system for our business using what we learn about them in depth.

Primrose Enterprise is about a system that can allow customers to check the availability
of the cars for rent and make a purchase through the system. Our system is designed to
prevent customers from double booked the same car on the same date and making it
easier for customers to make payments without having to consult with staff.
2.0 CASE STUDY

1. BACKGROUND

The online ordering system is one of the newest services that majority of
businesses in Malaysia have adopted since the Covid-19 outbreak has
significantly impacted them. This new way of buying not only offers a vast
selection of items, but it also provides a big market and a variety of economic
prospects. The project we are working on is creating a website to be used by
“Primrose Enterprise”, a car rental agency. By reducing labour costs, this strategy
will allow the manager to increase the size of their business. Using a few clicks,
clients may browse and use an online ordering system that is managed quickly
and easily thanks to technology. We provide a various brand of car to be rented
out with a reasonable price.

2. CURRENT SYSTEM DESCRIPTION

Our previous method required customers to contact us via phone calls or


physically attend to our branch to place orders or engage with us. One of the
staffs will take in charge of overseeing all bookings and car stock. After the
customers place their bookings, the employee must fill out all the information in
an Excel spreadsheet, including the car brand, time pickup and date returned,
customer information and the total amount need to be paid. In terms of payment,
customers can choose their selected payment method, whether online banking
via their credit or debit card, cash, or online banking and afterwards, they need to
notify the employee for the payment that has been made.

3. CURRENT SYSTEM PROBLEM

The approach of going to the branch to book the car manually by visiting
storefront businesses is getting outdated and time-consuming, especially since
Malaysia is still on recovery phase of COVID-19. Hence, by contacting via phone
calls, it could lead to miscommunication between staffs as they might mistook
cars that are available on the required date, especially during a public holiday
where demand for car rental is high.

4. SUGGESTED SOLUTION

To solve the problems, we planned to use the same system as before but with a
better level overview of the system. To make the system run smoothly, we will
modify our system we will also hand out our feedback review to all the customer
to fill in so we can find a solution on what to improve through the research. We
will also hire the best designer to design our project and will do a major
maintenance from time to time to improve our weakness.

5. SYSTEM OBJECTIVE
- Honing staff talent in handling with the new system
- Make it easier for customer to book their selected car wherever they are at
any time
3.0 ERD NARRATIVE

ENTITY NAME: CUSTOMER


ENTITY EXPLANATION: RECORD DATA OF CUSTOMER
ATTRIBUTE’ EXPLANAT DATA FORMAT REQUIRED PK/F FK
S ION TYPE (NOT K REFER
NAME NULL) ENCE
TABLE
CUST_ID Customer’s CHAR(8) XXXXX YES PK
ID
CUST_NAME Customer’s VARCHAR XXXXX YES
Name (18)
CUST_NO Customer’s VARCHAR XXXXX YES
Number (11)
CUST_ADD Customer’s VARCHAR XXXXX YES
Address (60)

ENTITY NAME: BOOKING


ENTITY EXPLANATION: RECORD OF CUSTOMER’S BOOKING
ATTRIBUTE’ EXPLANATIO DATA FORMAT REQUIRED PK/F FK
S N TYPE (NOT K REFER
NAME NULL) ENCE
TABLE
BOOKING_ID Booking’s ID CHAR XXXXX YES PK
(8)
BOOKING_D Booking’s DATE DD-MM- YES
ATE Date YYYY
CUST_ID Customer’s ID CHAR XXXXX YES FK
(8)
VEHICLE_ID Vehicle’s ID CHAR XXXXX YES FK
(4)
LOC_ID Location’s ID CHAR XXXXX YES
(4)
TOTAL_AMO Total Amount CURRE RMXXX YES
UNT NCY

ENTITY NAME: VEHICLE


ENTITY EXPLANATION: TYPE OF VEHICLE CUSTOMER BOOKED
ATTRIBUTE’S EXPLANATIO DATA FORMAT REQUIRED PK/F FK
NAME N TYPE (NOT K REFER
NULL) ENCE
TABLE
VEHICLE_ID Vehicle’s ID CHAR XXXXX YES PK
(4)
BOOKING_ID Booking’s ID CHAR XXXXX YES FK
(8)
CUST_ID Customer’s ID CHAR XXXXX YES FK
(8)
AMOUNT Amount CURRE RMXXX YES
NCY

ENTITY NAME: HONDA


ENTITY EXPLANATION: RECORD OF DATA FOR VEHICLE TYPE HONDA
ATTRIBUTE’S EXPLANATIO DATA FORMAT REQUIRE PK/FK FK
NAME N TYPE D REFER
(NOT ENCE
NULL) TABLE
VEHICLE_ID Vehicle’s ID CHAR XXXXX YES PK,FK
(4)
AMOUNT AMOUNT CURR RMXXX YES
ENCY

ENTITY NAME: YAMAHA


ENTITY EXPLANATION: RECORD OF DATA FOR VEHICLE TYPE YAMAHA
ATTRIBUTE’S EXPLANATI DATA FORMAT REQUIRE PK/F FK
NAME ON TYPE D K REFER
(NOT ENCE
NULL) TABLE
VEHICLE_ID Vehicle’s ID CHAR XXXXX YES PK,F
(4) K
AMOUNT AMOUNT CURR RMXXX YES
ENCY

ENTITY NAME: LAGENDA


ENTITY EXPLANATION: RECORD OF DATA FOR VEHICLE TYPE LAGENDA
ATTRIBUTE’S EXPLANATI DATA FORMAT REQUIRED PK/F FK
NAME ON TYPE (NOT K REFER
NULL) ENCE
TABLE
VEHICLE_ID Vehicle’s ID CHAR XXXXX YES PK,F
(4) K
AMOUNT AMOUNT CURRE RMXXX YES
NCY
ENTITY NAME: STAFF
ENTITY EXPLANATION: RECORD DATA OF STAFF HANDLE FOR THE BOOKING
ATTRIBUT EXPLANATI DATA FORMAT REQUIRED PK/F FK
E’S ON TYPE (NOT K REFERE
NAME NULL) NCE
TABLE
STAFF_ID Staff’s ID CHAR(8) XXXXX YES PK
STAFF_NA Staff’s Name VARCHAR XXXXX YES
ME (18)
CUST_ID Customer’s VARCHAR XXXXX YES
Number (11)

ENTITY NAME: LOCATION


ENTITY EXPLANATION: RECORDS OF LOCATION TO PICKUP/RETURN
VEHICLES
ATTRIBUTE EXPLANAT DATA FORMAT REQUIRED PK/F FK
’S ION TYPE (NOT K REFER
NAME NULL) ENCE
TABLE
LOC_ID Location’s CHAR(4) XXXXX YES PK
ID
LOC_ADD Location VARCHAR XXXXX
Address (60)

ENTITY NAME: AMOUNT


ENTITY EXPLANATION: TOTAL AMOUNT TO BE PAID BY CUSTOMER
ATTRIBUTE’S EXPLANATI DATA FORMAT REQUIRE PK/F FK
NAME ON TYPE D K REFERE
(NOT NCE
NULL) TABLE
BOOKING_ID Booking’s ID CHAR( XXXXX YES
8)
AMOUNT Total Amount CURR RMXXX
ENCY
4.0 DATABASE CONCEPTUAL DESIGN

4.1 ENTITY RELATIONSHIP DIAGRAM


4.2. Relational Diagram / Database Model

CUSTOMER (CUST_ID, CUST_NAME, CUST_NO, CUST_ADD)


BOOKING (BOOKING_ID, BOOKING_DATE, *CUST_ID, *VEHICLE_ID, LOCATION,
TOTAL_AMOUNT)
VEHICLE (VEHICLE_ID, *BOOKING_ID, *CUST_ID, AMOUNT, HONDA, YAMAHA,
LAGENDA)
STAFF (STAFF_ID, STAFF_NAME, *CUST_ID)
LOCATION (LOC_ID, LOC_ADD)
AMOUNT (*BOOKING_ID, AMOUNT)

4.3 3NF Table Structure

CUSTOMER (CUST_ID, CUST_NAME, CUST_NO, CUST_ADD)


BOOKING (BOOKING_ID, BOOKING_DATE, *CUST_ID, *VEHICLE_ID, LOCATION,
AMOUNT)
VEHICLE (VEHICLE_ID, *BOOKING_ID, *CUST_ID, AMOUNT, HONDA, YAMAHA,
LAGENDA)
HONDA (VEHICLE_ID)
YAMAHA (VEHICLE_ID)
LAGENDA (VEHICLE_ID)
STAFF (STAFF_ID, STAFF_NAME, *CUST_ID)
LOCATION (LOC_ID, LOC_ADD)
AMOUNT (*BOOKING_ID, AMOUNT)
5.0 DATABASE SYSTEM IMPLEMENTATION
5.1 Data Definition Language (DDL)
5.1.1 Create table statement

CREATE TABLE CUSTOMER (


CUST_ID INT NOT NULL PRIMARY KEY,
CUST_NAME CHAR(10) NOT NULL,
CUST_NO INT NOT NULL,
CUST_ADD CHAR(30) NOT NULL )

CREATE TABLE BOOKING (


BOOKING_ID INT NOT NULL UNIQUE,
BOOKING_DATE CHAR(7) NOT NULL,
CUST_ID INT NOT NULL,
VEHICLE_ID CHAR(20) NOT NULL,
LOCATION INT NOT NULL,
TOTAL_AMT CHAR(8) NOT NULL,
CONSTRAINT PKBOOKING PRIMARY KEY (BOOKING_ID),
CONSTRAINT FKCUSTOMER FOREIGN KEY (CUST_ID) REFERENCES
CUSTOMER,
CONSTRAINT FKVEHICLE FOREIGN KEY (VEHICLE_ID) REFERENCES VEHICLE);

CREATE TABLE VEHICLE (


VEHICLE_ID CHAR(8) NOT NULL UNIQUE,
BOOKING_ID INT NOT NULL,
CUST_ID INT NOT NULL,
AMOUNT CHAR(6),
CONSTRAINT PKVEHICLE PRIMARY KEY (VEHICLE_ID),
CONSTRAINT FKBOOKING FOREIGN KEY (BOOKING_ID) REFERENCES
BOOKING,
CONSTRAINT FKCUST FOREIGN KEY (CUST_ID) REFERENCES CUSTOMER );

CREATE TABLE HONDA (


VEHICLE_ID INT NOT NULL PRIMARY KEY,
AMOUNT CHAR(8))

CREATE TABLE YAMAHA (


VEHICLE_ID INT NOT NULL PRIMARY KEY,
AMOUNT CHAR(8) )

CREATE TABLE LAGENDA (


VEHICLE_ID INT NOT NULL PRIMARY KEY,
AMOUNT CHAR(8) )

CREATE TABLE STAFF (


STAFF_ID INT NOT NULL UNIQUE,
STAFF_NAME CHAR(20),
CUST_ID INT NOT NULL,
CONSTRAINT PKSTAFF PRIMARY KEY (STAFF_ID),
CONSTRAINT FKCUSTOMER FOREIGN KEY (CUST_ID) REFERENCES
CUSTOMER);

CREATE TABLE LOCATION (


LOC_ADD CHAR(100) NOT NULL UNIQUE,
CUST_ID INT NOT NULL,
CONSTRAINT PKLOCATION PRIMARY KEY (LOC_ADD),
CONSTRAINT FKCUSTOMER FOREIGN KEY (CUST_ID) REFERENCES
CUSTOMER);
CREATE TABLE PAYMENT (
BOOKING_ID INT NOT NULL UNIQUE,
AMOUNT CHAR(6),
CONSTRAINT PKPAYMENT PRIMARY KEY (BOOKING_ID),
CONSTRAINT FKBOOKING FOREIGN KEY (BOOKING_ID) REFERENCES
BOOKING);

5.1.2 CREATE A SINGLE VIEW TABLE


Create a view location where the location are ‘MELAKA’

SELECT BOOKING.BOOKING_ID, BOOKING.BOOKING_DATE, BOOKING.CUST_ID,


BOOKING.LOCATION
FROM BOOKING
WHERE (((BOOKING.LOCATION)=”MELAKA”));

5.1.3. CREATE VIEW MULTIPLE TABLE

Create a view multiple table where table booking and vehicle in one table

SELECT *
FROM BOOKING INNER JOIN VEHICLE
ON BOOKING.CUST_ID = VEHICLE.CUST_ID;
5.1.4. Create view single table (updatable)
SELECT *
FROM CUSTOMER
WHERE CUST_ID LIKE (‘1004’);

5.1.5. Create view multiple table (updatable)


SELECT *
FROM BOOKING
WHERE CUST_ID LIKE ‘1001’ OR BOOKING.VEHICLE_ID = VEHICLE.VEHICLE_ID;

5.1.6. Drop table statement

Delete REFUND Table


Code:
DROP TABLE REFUND;
5.1.7. Alter table statement
- ADD Column
ALTER TABLE BOOKING
ADD COLUMN BOOK TIME

- DROP Column

ALTER TABLE CUSTOMER


DROP COLUMN CUST_NO

- ALTER Column

ALTER TABLE BOOKING


ALTER COLUMN TOTAL_AMOUNT CHAR(5)
5.2 Data Manipulation Language (DML)

5.2.1 Insert Into Table Statement

1) Custome
Code:
INSERT INTO CUSTOMER
VALUES ('1005', 'ZAYN', ‘015236987’);
Results:

2) Booking
Code:
INSERT INTO BOOKING
VALUES (2001, '2/1/22', '1001', '5001', 'PENANG', 'RM80');
Results:

3) Vehicle
Code:
INSERT INTO VEHICLE
VALUES (5013, '2004', '5012', 'RM100');
Results:

4) Honda
Code:
INSERT INTO HONDA
VALUES ('5012', 'RM70');
Results:

5) Lagenda
Code:
INSERT INTO LAGENDA
VALUES ('5010', 'RM80');
Results:
6) Yamaha
Code:
INSERT INTO YAMAHA
VALUES (5013, 'RM100');
Results:

7) Staff
Code:
INSERT INTO STAFF
VALUES (3005, 'ZAINAL', '1005');
Results:

8) Location
Code:
INSERT INTO LOCATION
VALUES ('JOHOR', '1005');
Results:
9) Amount
Code:
INSERT INTO AMOUNT
VALUES (2004, 'RM100');
Results:

5.2.2 Insert Into View (updatable)


Code:
INSERT INTO HONDA
VALUES ('5011', 'RM70');
5.2.3 Update Table Statement
Update Customer Table
Code:
UPDATE CUSTOMER SET CUST_NO = ['000000']
WHERE CUST_ID = ['1005'];
Results:

5.2.4 Update view (updatable)


SELECT VEHICLE_ID, AMOUNT
FROM HONDA;

5.2.5 Delete table Statement


Delete the customer row which is id 1002.
Code:
DELETE *
FROM CUSTOMER
WHERE CUST_ID = 1002;
5.2.6 Select statement with minimum 20 records for all tables
(question, query statement, output)
Select queries (approximately 1 query for each operator)

5.2.6.1 Comparison operator


Find the table that total amount less than RM80.
SELECT *
FROM VEHICLE
WHERE AMOUNT<'RM80';
Results:

5.2.6.2 Logical operator (AND, OR, NOT)


List of the motor vehicle that have been booked either 5012 or 5013.

SELECT BOOKING_ID, CUST_ID, BOOKING_DATE, LOCATION, VEHICLE_ID


FROM BOOKING
WHERE (((BOOKING.VEHICLE_ID)=[5012])) OR (((BOOKING.VEHICLE_ID)=[5013]));
Results:
5.2.6.3 Special operator (LIKE, BETWEEN, DISTINCT)
List of the customers who booked motor vehicle to Melaka and amount between RM80
and RM100.
SELECT CUST_ID, LOCATION, TOTAL_AMOUNT
FROM BOOKING
WHERE LOCATION LIKE 'M*'
AND AMOUNT BETWEEN RM80 AND RM100;
Results:

5.2.6.4 Arithmetic function (*, /, +, -)


Sum up the total amount of booking, to find the profit of the business.
SELECT SUM(TOTAL_AMOUNT) AS TOT_VALUE
FROM BOOKING;
5.2.6.5 Column function and grouping
By customer, list location that customers have book and include the times.
SELECT LOCATION, COUNT(TOTAL_AMOUNT) AS TOT_TIMES
FROM BOOKING
GROUP BY LOCATION;
Results:

5.2.6.6 Type 1 Nested queries (IN, NOT, IN)


Using Type I nested queries to list which all of booking date except on 1/2/2022.
SELECT *
FROM BOOKING
WHERE BOOKING_DATE NOT IN ('1/2/22');

Results:
5.2.6.7 Type II Nested queries (EXIST, NOT EXIST)
Using Type II nested queries to list customer who booked vehicle ID 5012.
SELECT *
FROM CUSTOMER
WHERE EXISTS (
SELECT *
FROM BOOKING
WHERE CUSTOMER.CUST_ID = BOOKING.CUST_ID AND VEHICLE_ID = '5012');

Results:

5.2.6.8 RETRIEVE DATA FROM MULTIPLE TABLE

1. List the details of customers who booked the vehicle for less than RM100.
SELECT CUSTOMER.CUST_ID, CUSTOMER.CUST_NAME,
BOOKING.BOOKING_ID, BOOKING.TOTAL_AMOUNT
FROM (CUSTOMER INNER JOIN BOOKING ON CUSTOMER.CUST_ID =
BOOKING.CUST_ID)
WHERE (((BOOKING.TOTAL_AMOUNT)<RM100));

2. List the details of booking that have been paid between 27 March 2022 and 1
April 2022.
Code:
SELECT CUSTOMER.CUST_ID, CUSTOMER.CUST_NAME,
BOOKING.BOOKING_DATE
FROM (CUSTOMER INNER JOIN BOOKING ON CUSTOMER.CUST_ID =
BOOKING.CUST_ID)
WHERE (((BOOKING.BOOKING_DATE) BETWEEN [27/3/2022] AND [1/4/2022]));
Results:

3. List of the customers who booked a YAMAHA motorcar.


Code:
SELECT BOOKING.CUST_ID, CUSTOMER.CUST_NAME,
BOOKING.VEHICLE_ID
FROM (CUSTOMER INNER JOIN BOOKING ON CUSTOMER.CUST_ID =
BOOKING.CUST_ID)
WHERE BOOKING.VEHICLE_ID BETWEEN '5000' AND '5012';
Results:

4. Find a customer whose phone number starts with the number ‘01’.
Code:
SELECT BOOKING.CUST_ID, CUSTOMER.CUST_NAME,
BOOKING.VEHICLE_ID, CUSTOMER.CUST_NO
FROM (CUSTOMER INNER JOIN BOOKING ON CUSTOMER.CUST_ID =
BOOKING.CUST_ID)
WHERE CUST_NO LIKE '1*';

5. Find a customer whose name start with alphabet ‘A’.


Code:
SELECT *
FROM CUSTOMER
WHERE CUST_NAME LIKE 'A*';
Results:
5.2.7 SELECT statement for all views
Code:
SELECT *
FROM CUSTOMER, BOOKING, VEHICLE, HONDA, YAMAHA, LAGENDA,
STAFF, LOCATION, AMOUNT;
Results:
6.0 SYSTEM IMPLEMENTATION

6.1 The form and sub form are shown


a) Login Form

b) Booking Form
c) Availability form

d) Customer form
e) Exit Form

6.2. The report which include the calculation part are shown.
7.0 CONCLUSION

To summaries everything the business is still operating as normal as the company still
wants to maximize the profit. By enhancing the system, it is very convenient for people
to do their business using the current system. Besides, the current system that we are
using is a conventional method where a lot of misunderstandings can happen. Thus,
with the new system that the company implements, it will make it easier for people to
book their cars without any mistakes and misunderstandings.

Lastly, we strongly think that every service that we offer adds greatly to the smooth
operation of our project and the avoidance of any problems that might damage the
reputation of our company as we work hard to succeed. Moreover, we emphasize our
objective was already stated. It is because we include a platform that our company may
employ in every stage of the business for the purpose of our future operations. In
addition, this project contributes in giving the decision-maker the information they need
to determine any improvements or maintenance that are necessary to achieve the
desired results.
8.0 REFERENCES

Creating Entity Relationship Diagrams using Draw.io. (n.d.). Www.youtube.com.


Retrieved July 14, 2022, from https://www.youtube.com/watch?v=lAtCySGDD48

How to use Microsoft Sway - tutorial for beginners. (n.d.). Error! Hyperlink reference not
valid.

Retrieved July 16, 2022, from https://www.youtube.com/watch?v=OrYYQvPilSk&t=516s

SQL Tutorial. (2019). W3schools.com. https://www.w3schools.com/sql/

anandmeg. (n.d.). Tutorial: Get started with Visual Basic - Visual Studio (Windows).
Docs.microsoft.com. https://docs.microsoft.com/en-us/visualstudio/get-started/visual-
basic/tutorial-console?view=vs-2022
9.0 APPENDICES

You might also like