yudisentosa / SBDProjectSchool

0 stars 0 forks source link

Table - entry_log #16

Open licyawatidewi opened 3 years ago

licyawatidewi commented 3 years ago

DROP TABLE IF EXISTS entry_log; CREATE TABLE entry_log( visitor_id VARCHAR(5) NOT NULL ,date VARCHAR(10) NOT NULL ,entry_time VARCHAR(5) NOT NULL ,exit_time VARCHAR(5) NOT NULL ,purpose VARCHAR(23) NOT NULL ,facility_id VARCHAR(6) NOT NULL ,PRIMARY KEY(visitor_id, facility_id, date, entry_time) ,FOREIGN KEY (visitor_id) REFERENCES student(student_id) REFERENCES employee(employee_id) ,FOREIGN KEY (facility_id) REFERENCES facility(facility_id) ); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('2016','10/01/2020','13:59','14:14','Data fasilitas','FAC001'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00014','15/01/2020','12:10','12:14','Meminjam bola basket','FAC001'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00001','28/01/2020','14:30','14:35','Meminjam net','FAC003'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00017','30/01/2020','16:15','16:19','Meminjam bola','FAC002'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00016','05/02/2020','16:29','17:41','Bermain badminton','FAC003'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00015','06/02/2020','11:45','13:13','Bermain bola','FAC002'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00021','19/02/2020','15:00','16:00','Praktikum','FAC004'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3019','24/02/2020','10:45','11:13','Membersihkan ruangan','FAC006'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00002','02/03/2020','17:00','18:12','Latihan','FAC005'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3018','09/03/2020','10:06','10:31','Membersihkan ruangan','FAC007'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3020','10/03/2020','12:55','13:29','Membersihkan ruangan','FAC009'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3019','30/03/2020','10:26','11:00','Membersihkan ruangan','FAC010'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('2015','02/04/2020','9:35','9:54','Data fasilitas','FAC003'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3017','23/04/2020','14:45','15:10','Membersihkan ruangan','FAC005'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3018','28/04/2020','11:40','12:14','Membersihkan lapangan','FAC002'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00016','07/05/2020','16:55','17:01','Mengembalikan peralatan','FAC004'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00018','12/05/2020','15:25','16:50','Bermain basket','FAC001'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00007','20/05/2020','15:40','16:20','Latihan dance','FAC005'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('1009','25/05/2020','8:44','8:50','Mengambil barang','FAC008'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3017','02/06/2020','11:54','12:16','Membersihkan sampah','FAC002'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00005','10/06/2020','8:13','9:40','Bermain basket','FAC001'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3017','15/06/2020','12:20','13:01','Membersihkan lapangan','FAC001'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00009','18/06/2020','12:35','12:41','Ambil barang','FAC006'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00003','08/07/2020','16:20','17:31','Bermain bola','FAC002'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00013','17/07/2020','14:44','14:52','Ambil barang','FAC008'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00012','21/07/2020','13:37','14:43','Latihan dance','FAC005'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00007','24/07/2020','9:36','9:40','Ambil barang','FAC009'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3019','05/08/2020','13:10','13:44','Membersihkan lapangan','FAC002'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00008','18/08/2020','11:30','11:34','Ambil barang','FAC007'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00011','21/08/2020','13:55','14:01','Ambil barang','FAC010'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00006','01/09/2020','13:45','14:47','Bermain bola','FAC002'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00002','09/09/2020','12:52','13:58','Latihan dance','FAC005'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3020','17/09/2020','13:50','14:29','Praktikum','FAC004'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3018','22/09/2020','15:14','16:39','Latihan dance','FAC005'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00015','29/09/2020','9:25','10:47','Bermain basket','FAC001'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3017','02/10/2020','16:07','16:30','Membersihkan ruangan','FAC004'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00004','16/10/2020','16:51','17:39','Bermain badminton','FAC003'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00010','22/10/2020','13:09','14:00','Bermain bola','FAC002'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3018','23/10/2020','11:35','12:01','Membersihkan lapangan','FAC003'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00017','27/10/2020','10:00','11:04','Bermain badminton','FAC003'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00014','29/10/2020','7:43','7:52','Meminjam fasilitas','FAC002'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00001','03/11/2020','9:14','9:21','Ambil barang','FAC007'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00018','01/12/2020','15:55','16:02','Ambil barang','FAC010'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00016','14/12/2020','16:35','17:38','Bermain bola','FAC002'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00019','16/12/2020','16:45','17:49','Latihan dance','FAC005');

yudisentosa commented 3 years ago

DROP TABLE IF EXISTS entry_log; CREATE TABLE entry_log( visitor_id VARCHAR(5) NOT NULL ,date DATE NOT NULL ,entry_time VARCHAR(5) NOT NULL ,exit_time VARCHAR(5) NOT NULL ,purpose VARCHAR(23) NOT NULL ,facility_id VARCHAR(6) NOT NULL ,PRIMARY KEY(visitor_id, facility_id, date, entry_time) ,FOREIGN KEY (facility_id) REFERENCES facility(facility_id) ); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00013','2020-07-17','14:44','14:52','Ambil barang','FAC008'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00012','2020-07-21','13:37','14:43','Latihan dance','FAC005'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00007','2020-07-24','9:36','9:40','Ambil barang','FAC009'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3019','2020-08-05','13:10','13:44','Membersihkan lapangan','FAC002'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00008','2020-08-18','11:30','11:34','Ambil barang','FAC007'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00011','2020-08-21','13:55','14:01','Ambil barang','FAC010'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00006','2020-09-01','13:45','14:47','Bermain bola','FAC002'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00002','2020-09-09','12:52','13:58','Latihan dance','FAC005'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3020','2020-09-17','13:50','14:29','Praktikum','FAC004'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3018','2020-09-22','15:14','16:39','Latihan dance','FAC005'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00015','2020-09-29','9:25','10:47','Bermain basket','FAC001'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3017','2020-10-02','16:07','16:30','Membersihkan ruangan','FAC004'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00004','2020-10-16','16:51','17:39','Bermain badminton','FAC003'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00010','2020-10-22','13:09','14:00','Bermain bola','FAC002'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3018','2020-10-23','11:35','12:01','Membersihkan lapangan','FAC003'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00017','2020-10-27','10:00','11:04','Bermain badminton','FAC003'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00014','2020-10-29','7:43','7:52','Meminjam fasilitas','FAC002'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00001','2020-11-03','9:14','9:21','Ambil barang','FAC007'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00018','2020-12-01','15:55','16:02','Ambil barang','FAC010'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00016','2020-12-14','16:35','17:38','Bermain bola','FAC002'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00019','2020-12-16','16:45','17:49','Latihan dance','FAC005'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('2016','2021-01-10','13:59','14:14','Data fasilitas','FAC001'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00014','2021-01-15','12:10','12:14','Meminjam bola basket','FAC001'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00001','2021-01-28','14:30','14:35','Meminjam net','FAC003'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00017','2021-01-30','16:15','16:19','Meminjam bola','FAC002'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00016','2021-02-05','16:29','17:41','Bermain badminton','FAC003'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00015','2021-02-06','11:45','13:13','Bermain bola','FAC002'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00021','2021-02-19','15:00','16:00','Praktikum','FAC004'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3019','2021-02-24','10:45','11:13','Membersihkan ruangan','FAC006'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00002','2021-03-02','17:00','18:12','Latihan','FAC005'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3018','2021-03-09','10:06','10:31','Membersihkan ruangan','FAC007'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3020','2021-03-10','12:55','13:29','Membersihkan ruangan','FAC009'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3019','2021-03-30','10:26','11:00','Membersihkan ruangan','FAC010'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('2015','2021-04-02','9:35','9:54','Data fasilitas','FAC003'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3017','2021-04-23','14:45','15:10','Membersihkan ruangan','FAC005'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3018','2021-04-28','11:40','12:14','Membersihkan lapangan','FAC002'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00016','2021-05-07','16:55','17:01','Mengembalikan peralatan','FAC004'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00018','2021-05-12','15:25','16:50','Bermain basket','FAC001'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00007','2021-05-20','15:40','16:20','Latihan dance','FAC005'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('1009','2021-05-25','8:44','8:50','Mengambil barang','FAC008'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3017','2021-06-02','11:54','12:16','Membersihkan sampah','FAC002'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00005','2021-06-10','8:13','9:40','Bermain basket','FAC001'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('3017','2021-06-15','12:20','13:01','Membersihkan lapangan','FAC001'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00009','2021-06-18','12:35','12:41','Ambil barang','FAC006'); INSERT INTO entry_log(visitor_id,date,entry_time,exit_time,purpose,facility_id) VALUES ('00003','2021-07-08','16:20','17:31','Bermain bola','FAC002');

yudisentosa commented 3 years ago

sepertinya foreign key gk bisa pakai 2 references