-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.sql
333 lines (275 loc) · 8.26 KB
/
db.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 28, 2020 at 01:19 AM
-- Server version: 10.4.6-MariaDB
-- PHP Version: 7.3.8
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `courses`
--
CREATE DATABASE IF NOT EXISTS `courses` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `courses`;
-- --------------------------------------------------------
--
-- Table structure for table `courses`
--
CREATE TABLE `courses` (
`id` int(11) NOT NULL,
`subject` varchar(255) NOT NULL,
`price` int(11) NOT NULL,
`code` varchar(255) NOT NULL,
`teacher` varchar(255) NOT NULL,
`grade` varchar(255) NOT NULL,
`saturday` tinyint(1) DEFAULT NULL,
`sunday` tinyint(1) DEFAULT NULL,
`monday` tinyint(1) DEFAULT NULL,
`tuesday` tinyint(1) DEFAULT NULL,
`wednesday` tinyint(1) DEFAULT NULL,
`thursday` tinyint(1) DEFAULT NULL,
`friday` tinyint(1) DEFAULT NULL,
`description` text DEFAULT NULL,
`time1` time DEFAULT NULL,
`time2` time DEFAULT NULL,
`time3` time DEFAULT NULL,
`time4` time DEFAULT NULL,
`time5` time DEFAULT NULL,
`time6` time DEFAULT NULL,
`time7` time DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `daily_events`
--
CREATE TABLE `daily_events` (
`id` int(11) NOT NULL,
`Course` varchar(255) NOT NULL,
`Client` varchar(255) NOT NULL,
`event_type` varchar(255) NOT NULL,
`datetime` datetime NOT NULL,
`employee_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `employees`
--
CREATE TABLE `employees` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`age` int(11) NOT NULL,
`gender` varchar(50) NOT NULL,
`Email` varchar(255) DEFAULT NULL,
`phone` varchar(255) NOT NULL,
`salary` int(11) NOT NULL,
`date` datetime NOT NULL,
`national_id` bigint(20) NOT NULL,
`password` varchar(255) NOT NULL,
`permission` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `employees`
--
INSERT INTO `employees` (`id`, `name`, `age`, `gender`, `Email`, `phone`, `salary`, `date`, `national_id`, `password`, `permission`) VALUES
(1, 'Ahmed Hatem', 16, 'male', '[email protected]', '11', 10000, '2020-03-25 01:21:00', 1, '1', 'admin'),
(3, 'amr', 3, 'Male', '3', '3', 5000, '2020-03-25 14:48:21', 3, '3', 'co-admin'),
(4, 'mohamed', 34, 'male', '[email protected]', '0100000000', 2000, '2020-03-26 14:45:00', 440, '44', 'normal'),
(5, 'nour', 18, 'Male', '[email protected]', '012', 2323, '2020-03-26 02:56:44', 333, '55', 'normal'),
(6, 'kareem', 23, 'Male', '123', '015000', 3232, '2020-03-26 03:04:57', 123, '123', 'worker'),
(8, 'amr', 23, 'Male', 'sdasd', '321312', 2322, '2020-03-26 14:23:42', 21312, 'aa', 'worker');
-- --------------------------------------------------------
--
-- Table structure for table `grades`
--
CREATE TABLE `grades` (
`id` int(11) NOT NULL,
`grade_name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `grades`
--
INSERT INTO `grades` (`id`, `grade_name`) VALUES
(1, 'sec2');
-- --------------------------------------------------------
--
-- Table structure for table `history`
--
CREATE TABLE `history` (
`id` int(11) NOT NULL,
`employee_id` int(11) NOT NULL,
`action` varchar(255) NOT NULL,
`table` varchar(255) NOT NULL,
`date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `students`
--
CREATE TABLE `students` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`grade` varchar(255) NOT NULL,
`code` varchar(255) NOT NULL,
`Email` varchar(255) DEFAULT NULL,
`phone` varchar(255) DEFAULT NULL,
`parent_phone1` varchar(255) NOT NULL,
`parent_phone2` varchar(255) NOT NULL,
`parent_email` varchar(255) NOT NULL,
`national_id` bigint(20) DEFAULT NULL,
`join_date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `subjects`
--
CREATE TABLE `subjects` (
`id` int(11) NOT NULL,
`subject_name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `subjects`
--
INSERT INTO `subjects` (`id`, `subject_name`) VALUES
(1, 'arabic');
-- --------------------------------------------------------
--
-- Table structure for table `teachers`
--
CREATE TABLE `teachers` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`email` varchar(255) DEFAULT NULL,
`phone` varchar(255) NOT NULL,
`join_date` datetime DEFAULT NULL,
`national_id` bigint(20) DEFAULT NULL,
`subject` varchar(255) NOT NULL,
`code` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `teachers`
--
INSERT INTO `teachers` (`id`, `name`, `email`, `phone`, `join_date`, `national_id`, `subject`, `code`) VALUES
(3, 'ahmed', 'asdasd', '122', '2020-03-27 11:27:13', 23123, 'arabic', 'T-321');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `courses`
--
ALTER TABLE `courses`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `daily_events`
--
ALTER TABLE `daily_events`
ADD PRIMARY KEY (`id`),
ADD KEY `daily_events_employee_id` (`employee_id`);
--
-- Indexes for table `employees`
--
ALTER TABLE `employees`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `employees_phone` (`phone`),
ADD UNIQUE KEY `employees_national_id` (`national_id`),
ADD UNIQUE KEY `employees_Email` (`Email`);
--
-- Indexes for table `grades`
--
ALTER TABLE `grades`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `grades_grade_name` (`grade_name`);
--
-- Indexes for table `history`
--
ALTER TABLE `history`
ADD PRIMARY KEY (`id`),
ADD KEY `history_employee_id` (`employee_id`);
--
-- Indexes for table `students`
--
ALTER TABLE `students`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `students_Email` (`Email`),
ADD UNIQUE KEY `students_phone` (`phone`),
ADD UNIQUE KEY `students_national_id` (`national_id`);
--
-- Indexes for table `subjects`
--
ALTER TABLE `subjects`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `subjects_subject_name` (`subject_name`);
--
-- Indexes for table `teachers`
--
ALTER TABLE `teachers`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `teachers_phone` (`phone`),
ADD UNIQUE KEY `teachers_national_id` (`national_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `courses`
--
ALTER TABLE `courses`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `daily_events`
--
ALTER TABLE `daily_events`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `employees`
--
ALTER TABLE `employees`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `grades`
--
ALTER TABLE `grades`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `history`
--
ALTER TABLE `history`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `students`
--
ALTER TABLE `students`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `subjects`
--
ALTER TABLE `subjects`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `teachers`
--
ALTER TABLE `teachers`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `daily_events`
--
ALTER TABLE `daily_events`
ADD CONSTRAINT `daily_events_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`);
--
-- Constraints for table `history`
--
ALTER TABLE `history`
ADD CONSTRAINT `history_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;