-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqueries.sql
129 lines (115 loc) · 6.39 KB
/
queries.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
CREATE SCHEMA `users_meetings` ;
use users_meetings;
CREATE TABLE `users_meetings`.`users` (
`userID` INT NOT NULL,
`name` VARCHAR(45) NULL,
`age` INT NULL,
`gender` VARCHAR(45) NULL,
`email` VARCHAR(45) NULL,
PRIMARY KEY (`userID`),
UNIQUE INDEX `userID_UNIQUE` (`userID` ASC) VISIBLE);
INSERT INTO users (userID, name, age, gender, email) VALUES
(1, 'John Smith', 25, 'Male', '[email protected]'),
(2, 'Jane Doe', 30, 'Female', '[email protected]'),
(3, 'Mike Johnson', 40, 'Male', '[email protected]'),
(4, 'Sara Lee', 28, 'Female', '[email protected]'),
(5, 'David Kim', 32, 'Male', '[email protected]'),
(6, 'Emily Chen', 27, 'Female', '[email protected]'),
(7, 'James Brown', 45, 'Male', '[email protected]'),
(8, 'Megan Taylor', 29, 'Female', '[email protected]'),
(9, 'Chris Jackson', 38, 'Male', '[email protected]'),
(10, 'Linda Nguyen', 31, 'Female', '[email protected]'),
(11, 'Michael Lee', 24, 'Male', '[email protected]'),
(12, 'Sophia Rodriguez', 26, 'Female', '[email protected]'),
(13, 'William Davis', 35, 'Male', '[email protected]'),
(14, 'Ava Martinez', 33, 'Female', '[email protected]'),
(15, 'Daniel Hernandez', 29, 'Male', '[email protected]'),
(16, 'Emma Wilson', 28, 'Female', '[email protected]'),
(17, 'Matthew Garcia', 41, 'Male', '[email protected]'),
(18, 'Olivia Perez', 30, 'Female', '[email protected]'),
(19, 'Joseph Harris', 37, 'Male', '[email protected]'),
(20, 'Isabella Rivera', 25, 'Female', '[email protected]'),
(21, 'Christopher King', 43, 'Male', '[email protected]'),
(22, 'Chloe Green', 26, 'Female', '[email protected]'),
(23, 'Andrew Lee', 39, 'Male', '[email protected]'),
(24, 'Madison Taylor', 27, 'Female', '[email protected]'),
(25, 'Joshua Brown', 36, 'Male', '[email protected]'),
(26, 'Emily Davis', 29, 'Female', '[email protected]'),
(27, 'David Gonzalez', 42, 'Male', '[email protected]'),
(28, 'Mia Lopez', 23, 'Female', '[email protected]'),
(29, 'Ryan Perez', 34, 'Male', '[email protected]'),
(30, 'Avery Smith', 28, 'Female', '[email protected]');
CREATE TABLE `users_meetings`.`meetings` (
`meetingID` INT NOT NULL,
`title` VARCHAR(45) NULL,
`description` VARCHAR(45) NULL,
`isPublic` TINYINT NULL,
`audience` VARCHAR(145) NULL,
PRIMARY KEY (`meetingID`),
UNIQUE INDEX `meetingID_UNIQUE` (`meetingID` ASC) VISIBLE);
INSERT INTO meetings (meetingID, title, description, isPublic, audience) VALUES
(1, 'Team Meeting', 'Weekly meeting to discuss progress', 1, ''),
(2, 'Product Launch', 'Meeting to plan product launch', 0, '[email protected],[email protected],[email protected]'),
(3, 'Marketing Campaign', 'Meeting to discuss marketing campaign', 1, ''),
(4, 'Budget Review', 'Meeting to review budget', 0, '[email protected],[email protected],[email protected]'),
(5, 'Training Session', 'Training session for new employees', 1, ''),
(6, 'Client Meeting', 'Meeting with client to discuss project', 0, '[email protected],[email protected],[email protected]'),
(7, 'Performance Review', 'Meeting to conduct performance review', 1, ''),
(8, 'Brainstorming Session', 'Meeting to brainstorm new ideas', 0, '[email protected],[email protected],[email protected]'),
(9, 'Project Kickoff', 'Meeting to kickoff new project', 1, ''),
(10, 'Vendor Negotiations', 'Meeting to negotiate with vendors', 0, '[email protected],[email protected],[email protected]'),
(11, 'Executive Meeting', 'Meeting with executives to discuss strategy', 1, ''),
(12, 'Team Building', 'Team building activity for employees', 0, '[email protected],[email protected],[email protected]'),
(13, 'Quarterly Review', 'Meeting to conduct quarterly review', 1, ''),
(14, 'New Hire Orientation', 'Meeting to orient new hires', 0, '[email protected],[email protected],[email protected]'),
(15, 'Project Status', 'Meeting to discuss project status', 1, ''),
(16, 'Department Meeting', 'Meeting with department members', 0, '[email protected],[email protected],[email protected]'),
(17, 'Company Picnic', 'Annual company picnic', 1, ''),
(18, 'Interviews', 'Meeting to conduct job interviews', 0, '[email protected],[email protected],[email protected]'),
(19, 'Training Needs Assessment', 'Meeting to assess training needs', 1, ''),
(20, 'Product Development', 'Meeting to discuss product development', 0, '[email protected],[email protected]');
CREATE TABLE `users_meetings`.`meeting_instances` (
`meetingID` INT NOT NULL,
`orderID` INT NOT NULL,
`fromdatetime` DATETIME NULL,
`todatetime` DATETIME NULL,
PRIMARY KEY (`meetingID`, `orderID`),
INDEX `meetingID_UNIQUE` (`meetingID` ASC) VISIBLE,
INDEX `orderID_UNIQUE` (`orderID` ASC) VISIBLE,
CONSTRAINT `meetingID`
FOREIGN KEY (`meetingID`)
REFERENCES `users_meetings`.`meetings` (`meetingID`)
ON DELETE CASCADE
ON UPDATE RESTRICT);
-- Inserts for meeting instances of the first 5 meetings
INSERT INTO meeting_instances (meetingID, orderID, fromdatetime, todatetime)
VALUES
-- Meeting 1
(1, 1, '2023-05-10 09:00:00', '2023-09-10 11:30:00'),
(1, 2, '2023-05-10 13:00:00', '2023-09-10 15:30:00'),
(1, 3, '2023-05-10 17:00:00', '2023-05-30 19:30:00'),
-- Meeting 2
(2, 1, '2023-05-11 09:00:00', '2023-05-11 11:30:00'),
(2, 2, '2023-05-11 14:00:00', '2023-05-11 16:00:00'),
(2, 3, '2023-05-11 18:00:00', '2023-05-11 20:30:00'),
-- Meeting 3
(3, 1, '2023-05-12 09:30:00', '2023-05-12 11:00:00'),
(3, 2, '2023-05-12 14:00:00', '2023-05-12 16:30:00'),
(3, 3, '2023-05-12 19:00:00', '2023-05-12 21:00:00'),
-- Meeting 4
(4, 1, '2023-05-13 10:00:00', '2023-05-13 12:00:00'),
(4, 2, '2023-05-13 14:30:00', '2023-05-13 16:00:00'),
(4, 3, '2023-05-13 18:00:00', '2023-05-13 20:00:00'),
-- Meeting 5
(5, 1, '2023-05-14 11:00:00', '2023-05-14 13:30:00'),
(5, 2, '2023-05-14 15:00:00', '2023-05-14 17:30:00'),
(5, 3, '2023-05-14 19:00:00', '2023-05-14 21:00:00');
CREATE SCHEMA `events_log` ;
use events_log;
CREATE TABLE `events_log`.`events_log` (
`event_id` INT NOT NULL,
`userID` INT NOT NULL,
`event_type` VARCHAR(5) NULL,
`timestamp` DATETIME NULL,
PRIMARY KEY (`event_id`),
UNIQUE INDEX `event_id_UNIQUE` (`event_id` ASC) VISIBLE);