-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGYMDBMS.txt
48 lines (40 loc) · 1.03 KB
/
GYMDBMS.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
-- Create the database
CREATE DATABASE gymmanagement;
-- Use the database
USE gymmanagement;
-- Create the Members table
CREATE TABLE Members (
member_id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
contact_number VARCHAR(15),
email VARCHAR(255),
membership_type VARCHAR(50),
start_date DATE
);
-- Create the Trainers table
CREATE TABLE Trainers (
trainer_id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
speciality VARCHAR(255)
);
-- Create the Classes table
CREATE TABLE Classes (
class_id INT AUTO_INCREMENT PRIMARY KEY,
class_name VARCHAR(255) NOT NULL,
trainer_id INT,
time TIME
);
-- Create the Attendance table
CREATE TABLE Attendance (
attendance_id INT AUTO_INCREMENT PRIMARY KEY,
member_id INT,
class_id INT,
date DATE
);
-- Create the Payments table
CREATE TABLE Payments (
payment_id INT AUTO_INCREMENT PRIMARY KEY,
member_id INT,
amount DECIMAL(10, 2),
payment_date DATE
);