· 11 years ago · Jun 28, 2015, 04:04 PM
1pa-- phpMyAdmin SQL Dump
2-- version 4.2.11
3-- http://www.phpmyadmin.net
4--
5-- Host: localhost
6-- Generation Time: Jun 28, 2015 at 06:02 PM
7-- Server version: 5.6.21
8-- PHP Version: 5.6.3
9
10SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
11SET time_zone = "+00:00";
12
13
14/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
15/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
16/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
17/*!40101 SET NAMES utf8 */;
18
19--
20-- Database: `SAS`
21--
22
23-- --------------------------------------------------------
24
25--
26-- Table structure for table `Admin`
27--
28
29CREATE TABLE IF NOT EXISTS `Admin` (
30`id` int(11) NOT NULL,
31 `username` varchar(45) NOT NULL,
32 `password` varchar(256) NOT NULL
33) ENGINE=InnoDB DEFAULT CHARSET=utf8;
34
35-- --------------------------------------------------------
36
37--
38-- Table structure for table `Attendance_Sheet`
39--
40
41CREATE TABLE IF NOT EXISTS `Attendance_Sheet` (
42 `Datetime` datetime NOT NULL,
43 `Student_id` int(11) NOT NULL,
44 `Instructor_id` int(11) NOT NULL,
45 `Course_id` int(11) NOT NULL
46) ENGINE=InnoDB DEFAULT CHARSET=utf8;
47
48--
49-- Dumping data for table `Attendance_Sheet`
50--
51
52INSERT INTO `Attendance_Sheet` (`Datetime`, `Student_id`, `Instructor_id`, `Course_id`) VALUES
53('2015-06-27 16:23:10', 6, 6, 1),
54('2015-06-27 17:32:19', 6, 6, 1),
55('2015-06-27 17:37:11', 6, 6, 1),
56('2015-06-27 17:59:01', 6, 6, 1),
57('2015-06-27 18:22:39', 6, 6, 1),
58('2015-06-27 18:27:33', 6, 1, 1),
59('2015-06-27 18:28:52', 6, 1, 1),
60('2015-06-27 18:33:27', 6, 1, 1),
61('2015-06-27 18:35:40', 6, 1, 1),
62('2015-06-27 18:36:13', 6, 1, 1),
63('2015-06-27 18:36:44', 6, 6, 1),
64('2015-06-27 18:36:49', 6, 6, 1),
65('2015-06-27 18:37:54', 6, 6, 1),
66('2015-06-27 18:41:37', 6, 6, 1),
67('2015-06-27 19:08:54', 6, 6, 1),
68('2015-06-27 19:11:14', 6, 6, 2);
69
70-- --------------------------------------------------------
71
72--
73-- Table structure for table `Course`
74--
75
76CREATE TABLE IF NOT EXISTS `Course` (
77`id` int(11) NOT NULL,
78 `name` varchar(45) NOT NULL
79) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
80
81--
82-- Dumping data for table `Course`
83--
84
85INSERT INTO `Course` (`id`, `name`) VALUES
86(1, 'compilers'),
87(2, 'database'),
88(3, 'OR'),
89(4, 'HCI');
90
91-- --------------------------------------------------------
92
93--
94-- Table structure for table `Device`
95--
96
97CREATE TABLE IF NOT EXISTS `Device` (
98`id` int(11) NOT NULL,
99 `mac_address` varchar(45) NOT NULL,
100 `assigned_ip` varchar(45) NOT NULL,
101 `Student_id` int(11) NOT NULL
102) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
103
104--
105-- Dumping data for table `Device`
106--
107
108INSERT INTO `Device` (`id`, `mac_address`, `assigned_ip`, `Student_id`) VALUES
109(1, '00-14-22-01-23-45', '', 6);
110
111-- --------------------------------------------------------
112
113--
114-- Table structure for table `Instructor`
115--
116
117CREATE TABLE IF NOT EXISTS `Instructor` (
118`id` int(11) NOT NULL,
119 `username` varchar(45) NOT NULL,
120 `password` varchar(256) NOT NULL,
121 `email` varchar(45) NOT NULL,
122 `api_key` varchar(35) NOT NULL
123) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
124
125--
126-- Dumping data for table `Instructor`
127--
128
129INSERT INTO `Instructor` (`id`, `username`, `password`, `email`, `api_key`) VALUES
130(1, 'mike', '$2a$10$9ae04edecc58f136eb523eTm.2XioVETAzcFYvC.0.dTDWAAKG7IS', 'mike@gmail.com', '0909151e32f286525368d9b8e2716dcb'),
131(2, 'prof1', '$2a$10$680495e0981b87bd263b7uT78dqrSPYjQ0NJtnpSTj9WQwrWG7x1C', 'prof1@gmail.com', '62e292a76a1db2213a7e167b724fde96'),
132(3, 'omar', '$2a$10$57e6598897d85fe9b724auvcRZUFJliv8IlzproksuBoR0wl4tjJi', 'prof2@gmail.com', 'b88975bf31094c02950282e88bf18819'),
133(4, 'test', '$2a$10$35970e7d0ac7e2a3afb56u9p8nMeQdZg44tYAmolXhu5D7hD.qrtm', 'test@gmail.com', '94c12dca55bbbf4b8cf21bbdd59e52e9'),
134(5, 'test1', '$2a$10$5a59fa73a9d01cb870deee14jegDoPiA2S.i.ByIPIjAMYIwd/7Na', 'test1@gmail.com', 'a02dec075f9ca259c883a80710e0d863'),
135(6, 'test22', '$2a$10$79c8a0da398e7858887a4uSsF4ka30ND4m53dVMFgMqPfIAIZlWl.', 'test22@gmail.com', '3f9b03ea8cabd3a503e66528eae688f8');
136
137-- --------------------------------------------------------
138
139--
140-- Table structure for table `Instructor_Course`
141--
142
143CREATE TABLE IF NOT EXISTS `Instructor_Course` (
144 `Instructor_id` int(11) NOT NULL,
145 `Course_id` int(11) NOT NULL
146) ENGINE=InnoDB DEFAULT CHARSET=utf8;
147
148--
149-- Dumping data for table `Instructor_Course`
150--
151
152INSERT INTO `Instructor_Course` (`Instructor_id`, `Course_id`) VALUES
153(2, 1),
154(3, 1),
155(5, 1),
156(6, 1),
157(2, 2),
158(3, 2),
159(6, 2);
160
161-- --------------------------------------------------------
162
163--
164-- Table structure for table `Student`
165--
166
167CREATE TABLE IF NOT EXISTS `Student` (
168`id` int(11) NOT NULL,
169 `username` varchar(45) NOT NULL,
170 `password` varchar(256) NOT NULL,
171 `email` varchar(45) NOT NULL,
172 `api_key` varchar(35) NOT NULL
173) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
174
175--
176-- Dumping data for table `Student`
177--
178
179INSERT INTO `Student` (`id`, `username`, `password`, `email`, `api_key`) VALUES
180(1, 'tarek', '$2a$10$e46063e051bcb4ea11809u60nkBfWorru6b0.mh2.9UhkbzSkr4om', 'tarek@gmail.com', '49f37617b71b0953f7443b88900cbbcd'),
181(2, 'michael', '$2a$10$102b5e9dbbeafc4327effOqH2Lk.jistBD1die9UWS0aG/yF4wpFC', 'tarek1@gmail.com', '07288ee52ceb7bf3696257efd0a057bb'),
182(3, 'mike', '$2a$10$52e6022ac6ad908781527OggboXn7mDcVZBwrL.Oo1BQi5Y6UPpna', 'mike@gmail.com', '9f53254975c985c734593479421ded0f'),
183(4, 'Michael Azmy', '$2a$10$c19cfd90295431078522fOUQhxcoM6s36h45uqZ9nahhffT7ND8xe', 'michael@gmail.com', 'e3afdf0d84e5855306a2a8d4e01c9387'),
184(5, 'stu1', '$2a$10$f2f73be8c60345b7a7d21uTEimXSo5PXP9rhwsHRTwTr9Yc54WPIy', 'stu1@gmail.com', 'cccb99d7f881d9b0f6436ff271198344'),
185(6, 'S', '$2a$10$dc3c155a7057263b85f42Ob3Ri21vuqInwU0OqIouwDSN2oWc7QMW', 's@s.com', 'ac8f8d684e815c42efa37dadf85c787b');
186
187-- --------------------------------------------------------
188
189--
190-- Table structure for table `Student_Course`
191--
192
193CREATE TABLE IF NOT EXISTS `Student_Course` (
194 `Student_id` int(11) NOT NULL,
195 `Course_id` int(11) NOT NULL
196) ENGINE=InnoDB DEFAULT CHARSET=utf8;
197
198--
199-- Dumping data for table `Student_Course`
200--
201
202INSERT INTO `Student_Course` (`Student_id`, `Course_id`) VALUES
203(1, 1),
204(2, 1),
205(3, 1),
206(3, 2),
207(6, 3),
208(6, 4);
209
210--
211-- Indexes for dumped tables
212--
213
214--
215-- Indexes for table `Admin`
216--
217ALTER TABLE `Admin`
218 ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `username_UNIQUE` (`username`);
219
220--
221-- Indexes for table `Attendance_Sheet`
222--
223ALTER TABLE `Attendance_Sheet`
224 ADD PRIMARY KEY (`Datetime`,`Student_id`,`Instructor_id`,`Course_id`), ADD KEY `fk_Attendance Sheet_Student1_idx` (`Student_id`), ADD KEY `fk_Attendance Sheet_Instructor1_idx` (`Instructor_id`), ADD KEY `fk_Attendance Sheet_Course1_idx` (`Course_id`);
225
226--
227-- Indexes for table `Course`
228--
229ALTER TABLE `Course`
230 ADD PRIMARY KEY (`id`);
231
232--
233-- Indexes for table `Device`
234--
235ALTER TABLE `Device`
236 ADD PRIMARY KEY (`id`,`Student_id`), ADD UNIQUE KEY `mac_address_UNIQUE` (`mac_address`), ADD KEY `fk_Device_Student_idx` (`Student_id`);
237
238--
239-- Indexes for table `Instructor`
240--
241ALTER TABLE `Instructor`
242 ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `username_UNIQUE` (`username`), ADD UNIQUE KEY `email` (`email`);
243
244--
245-- Indexes for table `Instructor_Course`
246--
247ALTER TABLE `Instructor_Course`
248 ADD PRIMARY KEY (`Instructor_id`,`Course_id`), ADD KEY `fk_Instructor_has_Course_Course1_idx` (`Course_id`), ADD KEY `fk_Instructor_has_Course_Instructor1_idx` (`Instructor_id`);
249
250--
251-- Indexes for table `Student`
252--
253ALTER TABLE `Student`
254 ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `username_UNIQUE` (`username`), ADD UNIQUE KEY `email_UNIQUE` (`email`);
255
256--
257-- Indexes for table `Student_Course`
258--
259ALTER TABLE `Student_Course`
260 ADD PRIMARY KEY (`Student_id`,`Course_id`), ADD KEY `fk_Instructor_has_Course_Course1_idx` (`Course_id`), ADD KEY `fk_Instructor_has_Course_Instructor1_idx` (`Student_id`);
261
262--
263-- AUTO_INCREMENT for dumped tables
264--
265
266--
267-- AUTO_INCREMENT for table `Admin`
268--
269ALTER TABLE `Admin`
270MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
271--
272-- AUTO_INCREMENT for table `Course`
273--
274ALTER TABLE `Course`
275MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5;
276--
277-- AUTO_INCREMENT for table `Device`
278--
279ALTER TABLE `Device`
280MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
281--
282-- AUTO_INCREMENT for table `Instructor`
283--
284ALTER TABLE `Instructor`
285MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=7;
286--
287-- AUTO_INCREMENT for table `Student`
288--
289ALTER TABLE `Student`
290MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=7;
291--
292-- Constraints for dumped tables
293--
294
295--
296-- Constraints for table `Attendance_Sheet`
297--
298ALTER TABLE `Attendance_Sheet`
299ADD CONSTRAINT `fk_Attendance Sheet_Course1` FOREIGN KEY (`Course_id`) REFERENCES `Course` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
300ADD CONSTRAINT `fk_Attendance Sheet_Instructor1` FOREIGN KEY (`Instructor_id`) REFERENCES `Instructor` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
301ADD CONSTRAINT `fk_Attendance Sheet_Student1` FOREIGN KEY (`Student_id`) REFERENCES `Student` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
302
303--
304-- Constraints for table `Device`
305--
306ALTER TABLE `Device`
307ADD CONSTRAINT `fk_Device_Student` FOREIGN KEY (`Student_id`) REFERENCES `Student` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
308
309--
310-- Constraints for table `Instructor_Course`
311--
312ALTER TABLE `Instructor_Course`
313ADD CONSTRAINT `fk_Instructor_has_Course_Course1` FOREIGN KEY (`Course_id`) REFERENCES `Course` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
314ADD CONSTRAINT `fk_Instructor_has_Course_Instructor1` FOREIGN KEY (`Instructor_id`) REFERENCES `Instructor` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
315
316--
317-- Constraints for table `Student_Course`
318--
319ALTER TABLE `Student_Course`
320ADD CONSTRAINT `fk_Student_has_Course_Course1` FOREIGN KEY (`Course_id`) REFERENCES `Course` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
321ADD CONSTRAINT `fk_Student_has_Course_Student1` FOREIGN KEY (`Student_id`) REFERENCES `Student` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
322
323/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
324/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
325/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;