-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatabase-run-script.sql
94 lines (88 loc) · 1.86 KB
/
database-run-script.sql
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
CREATE DATABASE menagement_system;
USE menagement_system;
CREATE TABLE
teams (
ID int primary key auto_increment,
name varchar(75)
);
CREATE TABLE
employees (
ID int primary key auto_increment,
first_name varchar(50),
last_name varchar(50),
email varchar(100),
phone varchar(15),
hire_date date,
role varchar(50),
team_id int,
FOREIGN KEY (team_id) REFERENCES teams (ID) ON DELETE CASCADE
);
-- Example values
INSERT INTO
teams (name)
VALUES
('Development Team'),
('Marketing Team'),
('Sales Team'),
('HR Team'),
('Design Team');
INSERT INTO
employees (
first_name,
last_name,
email,
phone,
hire_date,
role,
team_id
)
VALUES
(
'John',
'Doe',
'123-456-7890',
'2023-01-15',
'Developer',
1
),
(
'Jane',
'Smith',
'234-567-8901',
'2023-02-20',
'Marketing Specialist',
2
),
(
'Emily',
'Johnson',
'345-678-9012',
'2023-03-10',
'Sales Associate',
3
),
(
'Michael',
'Brown',
'456-789-0123',
'2023-04-05',
'HR Manager',
4
),
(
'Sarah',
'Davis',
'567-890-1234',
'2023-05-12',
'UI/UX Designer',
5
);
-- add admin user
CREATE USER 'admin'@'%' IDENTIFIED VIA mysql_native_password USING 'QEC8u';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%'
REQUIRE NONE WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;