0% found this document useful (0 votes)
27 views11 pages

Final Project DataBase

This document describes the database design for a gym management system. It includes 7 tables to store information about admins, customers, class programs, payments, and more. The tables are logically designed and normalized. Sample data is inserted and primary/foreign keys are defined to link the tables together. The document provides the SQL queries needed to implement the database design.

Uploaded by

Yusuf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views11 pages

Final Project DataBase

This document describes the database design for a gym management system. It includes 7 tables to store information about admins, customers, class programs, payments, and more. The tables are logically designed and normalized. Sample data is inserted and primary/foreign keys are defined to link the tables together. The document provides the SQL queries needed to implement the database design.

Uploaded by

Yusuf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

The Final Project

Database System

Created by:Muhammad Yusuf (001202200028)


Kevin L. Naingolan (001202200168)

IT Class 1, Batch 22

Gym Management System Database


Table of Contents

Part A - Database Design Case Study......................................................................................... 1


A.1 Overview........................................................................................................................... 1
A.2 Business Functions............................................................................................................1
A.3 Data Requirements............................................................................................................ 1
Part B - Conseptual Data Modeling............................................................................................ 1
B.1 the Data..............................................................................................................................1
Part C - Logical Design – Schema Conversion and Normalisation..........................................2
C.1 Normalization.................................................................................................................... 2
C.2 Logical Design...................................................................................................................3
Part D - Implementation.............................................................................................................. 3
D.1 the Queries.........................................................................................................................3
Part E - Create PHP-Based Database Application.................................................................... 9
E.1 Link of the code below...................................................................................................... 9

i
Part A - Database Design Case Study

A.1 Overview
This is a Gym Management System Application that both users and
admin have their own system. The admin can add product, add category also
delete dan edit product. From the user’s side they can register account, login, see
the product, and buy it. The system is little bit simple with 7 total of table.

A.2 Business Functions


To book a program at the gym, the customer first registers, then logs in
using the account that has been created, then selects the class program available,
and finally pays for the program.

A.3 Data Requirements


The data we store in the database consists of the admin account,
customer's identity, the class program selected, and the type of payment used.

Part B - Conseptual Data Modeling

B.1 the Data

1
Part C - Logical Design – Schema Conversion and Normalisation

C.1 Normalization

2
C.2 Logical Design

Part D - Implementation

D.1 the Queries

CREATE TABLE `tbladmin` (


`admin_id` int(11) NOT NULL,
`name` varchar(50) DEFAULT NULL,
`email` varchar(50) DEFAULT NULL,
`phone` varchar(20) DEFAULT NULL,
`password` varchar(50) DEFAULT NULL,
`created_time` datetime DEFAULT NULL
)

3
INSERT INTO `tbladmin` (`admin_id`, `name`, `email`, `phone`, `password`,
`created_time`) VALUES
(1, 'admin', '[email protected]', '8996675832', 'qwerty', '2022-01-19 18:25:17');

CREATE TABLE `tblbooking` (


`booking_id` int(11) NOT NULL,
`booking_date` datetime DEFAULT NULL,
`package_id` int(11) DEFAULT NULL,
`fitness_package_name` varchar(50) DEFAULT NULL,
`price` int(11) DEFAULT NULL
)
INSERT INTO `tblbooking` (`booking_id`, `booking_date`, `package_id`,
`fitness_package_name`, `price`) VALUES
(1, '2023-04-04 11:22:37', 3, 'Diet Cardio Training', 700),
(2, '2023-04-06 13:53:20', 4, 'Beginner Muscle Builder', 250),
(3, '2023-04-07 13:13:20', 1, 'Fun Aerobic Training', 200);

CREATE TABLE `tblcategory` (


`category_id` int(11) NOT NULL,
`fitness_category` varchar(50) DEFAULT NULL
)
INSERT INTO `tblcategory` (`category_id`, `fitness_category`) VALUES
(1, 'Aerobic'),
(2, 'Cardio'),
(3, 'Muscle Strengthening');

CREATE TABLE `tbllevel` (


`package_id` int(11) NOT NULL,
`fitness_level_package` varchar(50) DEFAULT NULL
)

4
INSERT INTO `tbllevel` (`package_id`, `fitness_level_package`) VALUES
(1, 'Fun Sport'),
(2, 'Beginners'),
(3, 'Super Diet'),
(4, 'Intermediant'),
(5, 'Advance');

CREATE TABLE `tblpackage` (


`package_id` int(11) NOT NULL,
`fitness_package_name` varchar(50) DEFAULT NULL,
`category_id` int(11) DEFAULT NULL,
`level_package` int(11) DEFAULT NULL,
`package_duration` varchar(50) DEFAULT NULL,
`description_package` varchar(100) DEFAULT NULL,
`price_package` decimal(10,2) DEFAULT NULL
)
INSERT INTO `tblpackage` (`package_id`, `fitness_package_name`, `category_id`,
`level_package`, `package_duration`, `description_package`, `price_package`)
VALUES
(1, 'Fun Aerobic Training', 1, 1, '1 Month', 'perfect for those of you who want to try a
new and fun sport', '200.00'),
(2, 'Beginner Cardio Training', 2, 2, '3 Month', 'perfect for beginner who want to learn
more about cardio', '350.00'),
(3, 'Diet Cardio Training', 2, 3, '6 Month', 'for people who want to lose their weight
more effectively', '700.00'),
(4, 'Beginner Muscle Training', 3, 2, '1 Month', 'a beginner package for build your
muscle', '250.00'),
(5, 'Intermediant Muscle Training', 3, 4, '1 Month', 'an intermediant package for build
your muscle', '750.00'),
(6, 'Master Muscle Training', 3, 5, '3 Month', 'an advance package for build your
muscle', '1000.00');

5
CREATE TABLE `tblpayment` (
`PaymentID` int(11) NOT NULL,
`BookingID` int(11) DEFAULT NULL,
`BookingDate` datetime DEFAULT NULL,
`FitnessPackageName` varchar(50) DEFAULT NULL,
`PaymentDate` datetime DEFAULT NULL,
`PaymentMethodID` int(11) DEFAULT NULL,
`PaymentMethodName` varchar(50) DEFAULT NULL,
`PaymentCategoryID` int(11) DEFAULT NULL,
`PaymentCategoryName` varchar(50) DEFAULT NULL,
`Price` int(11) DEFAULT NULL
)
INSERT INTO `tblpayment` (`PaymentID`, `BookingID`, `BookingDate`,
`FitnessPackageName`, `PaymentDate`, `PaymentMethodID`,
`PaymentMethodName`, `PaymentCategoryID`, `PaymentCategoryName`, `Price`)
VALUES
(1, 1, '2023-04-04 11:22:37', 'Diet Cardio Training', '2023-04-04 11:23:37', 3, 'BCA', 1,
'Bank', 700),
(2, 2, '2023-04-06 13:53:20', 'Beginner Muscle Builder', '2023-04-06 13:54:20', 9,
'Cash', 3, 'Cash', 250),
(3, 3, '2023-04-07 13:13:20', 'Fun Aerobic Training', '2023-04-07 13:14:20', 6, 'Gopay',
2, 'E-Money', 200);

CREATE TABLE `tblpaymentcategory` (


`PaymentCategoryID` int(11) NOT NULL,
`PaymentCategoryName` varchar(50) DEFAULT NULL
)

6
INSERT INTO `tblpaymentcategory` (`PaymentCategoryID`,
`PaymentCategoryName`) VALUES
(1, 'Bank'),
(2, 'E-Money'),
(3, 'Cash');

CREATE TABLE `tblpaymentmethod` (


`PaymentMethodID` int(11) NOT NULL,
`PaymentMethodName` varchar(50) DEFAULT NULL,
`PaymentCategoryID` int(11) DEFAULT NULL,
`PaymentCategoryName` varchar(50) DEFAULT NULL
)
INSERT INTO `tblpaymentmethod` (`PaymentMethodID`, `PaymentMethodName`,
`PaymentCategoryID`, `PaymentCategoryName`) VALUES
(1, 'BRI', 1, 'Bank'),
(2, 'BNI', 1, 'Bank'),
(3, 'BCA', 1, 'Bank'),
(4, 'Mandiri', 1, 'Bank'),
(5, 'Ovo', 2, 'E-Money'),
(6, 'Gopay', 2, 'E-Money'),
(7, 'Dana', 2, 'E-Money'),
(8, 'Shopee Pay', 2, 'E-Money'),
(9, 'Cash', 3, 'Cash');

CREATE TABLE `tblusers` (


`user_id` int(11) NOT NULL,
`first_name` varchar(50) DEFAULT NULL,
`last_name` varchar(50) DEFAULT NULL,
`email` varchar(50) DEFAULT NULL,
`phone` varchar(20) DEFAULT NULL,
`password` varchar(50) DEFAULT NULL,

7
`city` varchar(50) DEFAULT NULL,
`state` varchar(50) DEFAULT NULL,
`address` varchar(100) DEFAULT NULL,
`created_time` datetime DEFAULT NULL
)
INSERT INTO `tblusers` (`user_id`, `first_name`, `last_name`, `email`, `phone`,
`password`, `city`, `state`, `address`, `created_time`) VALUES
(1, 'Muhammad', 'Yusuf', '[email protected]', '987654321', 'qwerty', 'cikarang',
'indonesia', 'NBH, North Cikarang', '2023-04-03 11:51:12');

ALTER TABLE `tbladmin`


ADD PRIMARY KEY (`admin_id`);
ALTER TABLE `tblbooking`
ADD PRIMARY KEY (`booking_id`),
ADD KEY `package_id` (`package_id`);
ALTER TABLE `tblcategory`
ADD PRIMARY KEY (`category_id`);
ALTER TABLE `tbllevel`
ADD PRIMARY KEY (`package_id`);
ALTER TABLE `tblpackage`
ADD PRIMARY KEY (`package_id`),
ADD KEY `category_id` (`category_id`),
ADD KEY `level_package` (`level_package`);
ALTER TABLE `tblpayment`
ADD PRIMARY KEY (`PaymentID`),
ADD KEY `BookingID` (`BookingID`),
ADD KEY `PaymentMethodID` (`PaymentMethodID`),
ADD KEY `PaymentCategoryID` (`PaymentCategoryID`);
ALTER TABLE `tblpaymentcategory`
ADD PRIMARY KEY (`PaymentCategoryID`);
ALTER TABLE `tblpaymentmethod`

8
ADD PRIMARY KEY (`PaymentMethodID`),
ADD KEY `PaymentCategoryID` (`PaymentCategoryID`);
ALTER TABLE `tblusers`
ADD PRIMARY KEY (`user_id`);
ALTER TABLE `tblbooking`
ADD CONSTRAINT `tblbooking_ibfk_1` FOREIGN KEY (`package_id`)
REFERENCES `tblpackage` (`package_id`);
ALTER TABLE `tblpackage`
ADD CONSTRAINT `tblpackage_ibfk_1` FOREIGN KEY (`category_id`)
REFERENCES `tblcategory` (`category_id`),
ADD CONSTRAINT `tblpackage_ibfk_2` FOREIGN KEY (`level_package`)
REFERENCES `tbllevel` (`package_id`);
ALTER TABLE `tblpayment`
ADD CONSTRAINT `tblpayment_ibfk_1` FOREIGN KEY (`BookingID`)
REFERENCES `tblbooking` (`booking_id`),
ADD CONSTRAINT `tblpayment_ibfk_2` FOREIGN KEY (`PaymentMethodID`)
REFERENCES `tblpaymentmethod` (`PaymentMethodID`),
ADD CONSTRAINT `tblpayment_ibfk_3` FOREIGN KEY (`PaymentCategoryID`)
REFERENCES `tblpaymentcategory` (`PaymentCategoryID`);
ALTER TABLE `tblpaymentmethod`
ADD CONSTRAINT `tblpaymentmethod_ibfk_1` FOREIGN KEY
(`PaymentCategoryID`) REFERENCES `tblpaymentcategory`
(`PaymentCategoryID`);

Part E - Create PHP-Based Database Application

E.1 Link of the code below

https://github.com/Muhayuf/GymManagementSystem

You might also like