0% found this document useful (0 votes)
40 views12 pages

DBMS Sbid PDF

Uploaded by

Sujith Yadav
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)
40 views12 pages

DBMS Sbid PDF

Uploaded by

Sujith Yadav
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/ 12

USER INTERFACE DESIGN DIAGRAMS

The user interface design for the Fitness Management System (FMS) is crucial for
providing a seamless and intuitive experience for all user types - members, trainers, and
administrators. The following diagrams illustrate the key screens and flows within the
application.

1. LOGIN SCREEN

This diagram depicts the login process for the FMS application. Users have three
different options to log in: as a Member, Trainer, or Admin. Depending on the user type
selected, they are directed to the corresponding login screen, which then leads them to
their respective dashboards or portals.
2. MEMBER DASHBOARD FLOW

This diagram outlines the different functionalities available to members within the FMS
application. From the Member Dashboard, users can access various features, such as
viewing their profile, booking a fitness session, checking their workout logs, reviewing
their diet plan, and making payments.

3. TRAINER PORTAL FLOW

This diagram shows the various features available to trainers within the FMS
application. Trainers can access their schedule, manage members assigned to them,
create and assign diet plans, and track the progress of their members.
4. ADMIN CONSOLE FLOW

This diagram outlines the administrative features available in the FMS application.
Admins can access the Member Management, Trainer Management, Payment
Overview, and Reporting functionalities.
DATA TYPES AND THEIR DESCRIPTION

-- Member Table
CREATE TABLE Member (
Member_ID INT AUTO_INCREMENT PRIMARY KEY,
Name VARCHAR(100) NOT NULL,
Address VARCHAR(255),
Phone VARCHAR(15),
Email VARCHAR(100) UNIQUE,
Membership_Status ENUM('Active', 'Inactive') DEFAULT 'Active'
);
-- Insert sample Members
INSERT INTO Member (Name, Address, Phone, Email, Membership_Status) VALUES
('John Doe', '123 Maple St', '555-1234', '[email protected]', 'Active'),
('Jane Smith', '456 Oak St', '555-5678', '[email protected]', 'Active'),
('Mike Johnson', '789 Pine St', '555-9012', '[email protected]', 'Inactive'),
('Emily Davis', '101 Cedar St', '555-3456', '[email protected]', 'Active'),
('Sarah Brown', '102 Walnut St', '555-7890', '[email protected]', 'Active'),
('David Wilson', '103 Chestnut St', '555-2345', '[email protected]', 'Inactive'),
('Linda Martinez', '104 Birch St', '555-6789', '[email protected]', 'Active'),
('James Anderson', '105 Elm St', '555-4321', '[email protected]', 'Inactive'),
('Patricia Taylor', '106 Spruce St', '555-8765', '[email protected]', 'Active'),
('Robert Thomas', '107 Willow St', '555-2109', '[email protected]', 'Active');
-- Select all members
SELECT * FROM Member;

OUTPUT :

MEMBERS TABLE
-- Trainer Table
CREATE TABLE Trainer (
Trainer_ID INT AUTO_INCREMENT PRIMARY KEY,
Name VARCHAR(100) NOT NULL,
Specialty VARCHAR(50),
Contact VARCHAR(15)
);
-- Insert sample Trainers
INSERT INTO Trainer (Name, Specialty, Contact) VALUES
('Alex Turner', 'Strength Training', '555-6789'),
('Maria Johnson', 'Yoga', '555-2345'),
('Chris White', 'Cardio', '555-1234'),
('Jessica King', 'Nutrition', '555-5678'),
('David Scott', 'CrossFit', '555-3456'),
('Emma Stone', 'Pilates', '555-9012'),
('John Reed', 'Endurance', '555-7890'),
('Sophia Lee', 'Aerobics', '555-2109'),
('William Carter', 'Bodybuilding', '555-8765'),
('Isabella Perez', 'Zumba', '555-4321');
-- Select all trainers
SELECT * FROM Trainer;

OUTPUT :

TRAINER TABLE
-- Admin Table
CREATE TABLE Admin (
Admin_ID INT AUTO_INCREMENT PRIMARY KEY,
Username VARCHAR(50) UNIQUE NOT NULL,
Password VARCHAR(255) NOT NULL -- Make sure to hash passwords in the
application layer
);
-- Insert sample Admins
INSERT INTO Admin (Username, Password) VALUES
('admin1', 'hashed_password_1'),
('admin2', 'hashed_password_2'),
('admin3', 'hashed_password_3'),
('admin4', 'hashed_password_4'),
('admin5', 'hashed_password_5'),
('admin6', 'hashed_password_6'),
('admin7', 'hashed_password_7'),
('admin8', 'hashed_password_8'),
('admin9', 'hashed_password_9'),
('admin10', 'hashed_password_10');
-- Select all admins
SELECT * FROM Admin;

OUTPUT :

ADMIN TALE
-- Workout_Log Table
CREATE TABLE Workout_Log (
Log_ID INT AUTO_INCREMENT PRIMARY KEY,
Member_ID INT,
Date DATE,
Exercise VARCHAR(50),
Sets INT,
Reps INT,
Weight DECIMAL(5, 2),
FOREIGN KEY (Member_ID) REFERENCES Member(Member_ID) ON DELETE
CASCADE
);
-- Insert sample Workout Logs
INSERT INTO Workout_Log (Member_ID, Date, Exercise, Sets, Reps, Weight) VALUES
(1, '2023-01-10', 'Bench Press', 4, 10, 50.0),
(2, '2023-01-12', 'Squats', 4, 12, 80.0),
(3, '2023-01-14', 'Deadlift', 3, 8, 100.0),
(4, '2023-01-16', 'Push-Ups', 5, 20, NULL),
(5, '2023-01-18', 'Pull-Ups', 3, 15, NULL),
(6, '2023-01-20', 'Lunges', 4, 12, 20.0),
(7, '2023-01-22', 'Bicep Curl', 3, 10, 15.0),
(8, '2023-01-24', 'Tricep Dip', 4, 12, NULL),
(9, '2023-01-26', 'Leg Press', 4, 10, 150.0),
(10, '2023-01-28', 'Shoulder Press', 3, 10, 30.0);
-- Select all workout logs
SELECT * FROM Workout_Log;

OUTPUT :

WORKOUT LOGS TABLE


-- Diet_Plan Table
CREATE TABLE Diet_Plan (
Plan_ID INT AUTO_INCREMENT PRIMARY KEY,
Trainer_ID INT,
Member_ID INT,
Plan_Details TEXT,
FOREIGN KEY (Trainer_ID) REFERENCES Trainer(Trainer_ID) ON DELETE SET
NULL,
FOREIGN KEY (Member_ID) REFERENCES Member(Member_ID) ON DELETE
CASCADE
);
-- Insert sample Diet Plans
INSERT INTO Diet_Plan (Trainer_ID, Member_ID, Plan_Details) VALUES
(1, 1, 'Low carb, high protein diet'),
(2, 2, 'Vegan diet with high protein'),
(3, 3, 'Balanced diet with emphasis on fruits and vegetables'),
(4, 4, 'High fiber, low sugar diet'),
(5, 5, 'Paleo diet with lean meats and vegetables'),
(6, 6, 'Keto diet, high fat and low carbs'),
(7, 7, 'Mediterranean diet with healthy fats'),
(8, 8, 'High protein diet with low fats'),
(9, 9, 'Low sodium, high potassium diet'),
(10, 10, 'Diet with calorie deficit for weight loss');
-- Select all diet plans
SELECT * FROM Diet_Plan;

OUTPUT :

DIET PLAN TABLE


-- Session Table
CREATE TABLE Session (
Session_ID INT AUTO_INCREMENT PRIMARY KEY,
Date DATE,
Time TIME,
Trainer_ID INT,
FOREIGN KEY (Trainer_ID) REFERENCES Trainer(Trainer_ID) ON DELETE SET
NULL
);
-- Insert sample Sessions
INSERT INTO Session (Date, Time, Trainer_ID) VALUES
('2023-02-01', '10:00:00', 1),
('2023-02-02', '11:00:00', 2),
('2023-02-03', '09:00:00', 3),
('2023-02-04', '14:00:00', 4),
('2023-02-05', '13:00:00', 5),
('2023-02-06', '15:00:00', 6),
('2023-02-07', '16:00:00', 7),
('2023-02-08', '12:00:00', 8),
('2023-02-09', '10:30:00', 9),
('2023-02-10', '09:30:00', 10);
-- Select all sessions
SELECT * FROM Session;

OUTPUT :

SESSION TABLE
-- Payment Table
CREATE TABLE Payment (
Payment_ID INT AUTO_INCREMENT PRIMARY KEY,
Member_ID INT,
Amount DECIMAL(10, 2),
Payment_Date DATE,
Payment_Type ENUM('Membership Fee', 'Session Booking'),
FOREIGN KEY (Member_ID) REFERENCES Member(Member_ID) ON DELETE
CASCADE
);
-- Insert sample Payments
INSERT INTO Payment (Member_ID, Amount, Payment_Date, Payment_Type)
VALUES
(1, 100.00, '2023-01-05', 'Membership Fee'),
(2, 20.00, '2023-01-15', 'Session Booking'),
(3, 100.00, '2023-02-05', 'Membership Fee'),
(4, 30.00, '2023-02-12', 'Session Booking'),
(5, 50.00, '2023-02-20', 'Session Booking'),
(6, 100.00, '2023-03-01', 'Membership Fee'),
(7, 40.00, '2023-03-05', 'Session Booking'),
(8, 100.00, '2023-03-10', 'Membership Fee'),
(9, 35.00, '2023-03-15', 'Session Booking'),
(10, 50.00, '2023-03-20', 'Session Booking');
-- Select all payments
SELECT * FROM Payment;

OUTPUT :

PAYMENT TABLE
PLANNING AND IMPLEMENTING REFERENTIAL INTEGRITY

CREATING CASCADING RELATIONSHIPS : CASCADE DELETE AND UPDATE

-- Cascade DELETE on Workout_Log when Member is deleted


ALTER TABLE Workout_Log
ADD CONSTRAINT fk_workout_member
FOREIGN KEY (Member_ID) REFERENCES Member(Member_ID)
ON DELETE CASCADE;

-- Cascade DELETE on Diet_Plan when Member or Trainer is deleted


ALTER TABLE Diet_Plan
ADD CONSTRAINT fk_diet_member
FOREIGN KEY (Member_ID) REFERENCES Member(Member_ID)
ON DELETE CASCADE;

ALTER TABLE Diet_Plan


ADD CONSTRAINT fk_diet_trainer
FOREIGN KEY (Trainer_ID) REFERENCES Trainer(Trainer_ID)
ON DELETE CASCADE;

-- Cascade DELETE on Payment when Member is deleted


ALTER TABLE Payment
ADD CONSTRAINT fk_payment_member
FOREIGN KEY (Member_ID) REFERENCES Member(Member_ID)
ON DELETE CASCADE;

-- Cascade DELETE and UPDATE on Session when Trainer is deleted or updated


ALTER TABLE Session
ADD CONSTRAINT fk_session_trainer
FOREIGN KEY (Trainer_ID) REFERENCES Trainer(Trainer_ID)
ON DELETE CASCADE
ON UPDATE CASCADE;
OUTPUT :

-- Delete a member and cascade delete related records in Workout_Log, Diet_Plan, and
Payment tables
DELETE FROM Member WHERE Member_ID = 1;

-- Delete a trainer and cascade delete related records in Diet_Plan and Session tables
DELETE FROM Trainer WHERE Trainer_ID = 2;

OUTPUT :

You might also like