Chinastark commited on
Commit
0fd7c4a
·
verified ·
1 Parent(s): a26e64f

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +7 -0
  2. README.txt +133 -0
  3. database/baseball_1/schema.sql +3 -0
  4. database/farm/farm.sqlite +0 -0
  5. database/manufacturer/manufacturer.sqlite +0 -0
  6. database/museum_visit/museum_visit.sqlite +0 -0
  7. database/tvshow/tvshow.sqlite +0 -0
  8. database/wta_1/wta_1.sqlite +3 -0
  9. test_database/aan_1/aan_1.sqlite +3 -0
  10. test_database/aan_1/schema.sql +0 -0
  11. test_database/allergy_1/schema.sql +132 -0
  12. test_database/apartment_rentals/schema.sql +170 -0
  13. test_database/architecture/schema.sql +65 -0
  14. test_database/assets_maintenance/assets_maintenance.sqlite +0 -0
  15. test_database/assets_maintenance/schema.sql +355 -0
  16. test_database/bakery_1/bakery_1_michi.txt +411 -0
  17. test_database/baseball_1/baseball_1.sqlite +3 -0
  18. test_database/baseball_1/schema.sql +3 -0
  19. test_database/bike_racing/bike_racing.sqlite +0 -0
  20. test_database/bike_racing/schema_old.sql +56 -0
  21. test_database/body_builder/body_builder.sqlite +0 -0
  22. test_database/body_builder/schema.sql +37 -0
  23. test_database/chinook_1/chinook_1.sqlite +3 -0
  24. test_database/city_record/schema.sql +88 -0
  25. test_database/coffee_shop/coffee_shop.sqlite +0 -0
  26. test_database/company_1/company_1.sqlite +0 -0
  27. test_database/company_1/link.txt +1 -0
  28. test_database/concert_singer/concert_singer.sqlite +0 -0
  29. test_database/concert_singer/schema.sql +85 -0
  30. test_database/county_public_safety/county_public_safety.sqlite +0 -0
  31. test_database/county_public_safety/schema.sql +56 -0
  32. test_database/cre_Docs_and_Epenses/schema.sql +117 -0
  33. test_database/cre_Drama_Workshop_Groups/cre_Drama_Workshop_Groups.sqlite +3 -0
  34. test_database/customer_complaints/customer_complaints.sqlite +0 -0
  35. test_database/customer_complaints/schema.sql +83 -0
  36. test_database/decoration_competition/schema.sql +58 -0
  37. test_database/district_spokesman/district_spokesman.sqlite +0 -0
  38. test_database/dorm_1/dorm_1.sqlite +0 -0
  39. test_database/election_representative/schema.sql +37 -0
  40. test_database/film_rank/schema.sql +70 -0
  41. test_database/flight_2/annotation.json +38 -0
  42. test_database/flight_2/flight_2.json +121 -0
  43. test_database/flight_2/flight_2.sqlite +0 -0
  44. test_database/flight_2/link.txt +1 -0
  45. test_database/flight_2/q.txt +15 -0
  46. test_database/flight_4/flight_4.sqlite +3 -0
  47. test_database/game_1/game_1.sqlite +0 -0
  48. test_database/gymnast/schema.sql +45 -0
  49. test_database/imdb/imdb.sqlite +3 -0
  50. test_database/inn_1/change_date.py +26 -0
.gitattributes CHANGED
@@ -57,3 +57,10 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
57
  # Video files - compressed
58
  *.mp4 filter=lfs diff=lfs merge=lfs -text
59
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
57
  # Video files - compressed
58
  *.mp4 filter=lfs diff=lfs merge=lfs -text
59
  *.webm filter=lfs diff=lfs merge=lfs -text
60
+ *.sqlite filter=lfs diff=lfs merge=lfs -text
61
+ *.json filter=lfs diff=lfs merge=lfs -text
62
+ *.* filter=lfs diff=lfs merge=lfs -text
63
+ * filter=lfs diff=lfs merge=lfs -text
64
+ *.csv filter=lfs diff=lfs merge=lfs -text
65
+ . filter=lfs diff=lfs merge=lfs -text
66
+ database/formula_1/data_csv/qualifying.csv filter=lfs diff=lfs merge=lfs -text
README.txt ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 08/03/2020 updated: corrected column name and column name original mismatch in 2 dbs (scholar and formula_1) in tables.json. Also, used process_sql.py to reparse SQL queries (this only affects some models (e.g. RATSQL) which use our parsed SQL as the SQL input).
2
+ # 06/01/2020 updated: corrected ~40 annotation errors/mismatches in dev.json
3
+
4
+
5
+
6
+ This folder contains the Spider training and dev data sets for the EMNLP 2018 paper Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Task.
7
+
8
+ It contains the following files:
9
+
10
+ - train_spider.json
11
+ # Training Examples: 7000
12
+ # Databases: 140
13
+ - train_others.json
14
+ # Training Examples: 1659
15
+ # Databases: 6
16
+ - dev.json
17
+ # Training Examples: 1034
18
+ # Databases: 20
19
+ - tables.json
20
+ # Databases: 166
21
+ - dev_gold.sql
22
+ - train_gold.sql
23
+ - database/
24
+ - README.txt
25
+
26
+ The official final Spider training data set combines train_spider.json and train_others.json.
27
+ The databases used in train_others.json are from Restaurants, GeoQuery, Scholar, Academic, IMDB, and Yelp which are prepared by Finegan-Dollak et al., 2018.
28
+ The databases and SQL examples in train_spider.json are originally prepared by us.
29
+ For the format of each json file, please refer to our github page https://github.com/taoyds/spider.
30
+ In database/, there is one folder for each database which contains the [db_name].sqlite file.
31
+ For most databases, we also provide a schema.sql file with SQL statements to create the database.
32
+
33
+ If you use the dataset, please cite the following papers including Finegan-Dollak et al., 2018 and the original datasets for Restaurants, GeoQuery, Scholar, Academic, IMDB, and Yelp.
34
+
35
+ @inproceedings{Yu&al.18c,
36
+ year = 2018,
37
+ title = {Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Task},
38
+ booktitle = {EMNLP},
39
+ author = {Tao Yu and Rui Zhang and Kai Yang and Michihiro Yasunaga and Dongxu Wang and Zifan Li and James Ma and Irene Li and Qingning Yao and Shanelle Roman and Zilin Zhang and Dragomir Radev }
40
+ }
41
+
42
+ @InProceedings{P18-1033,
43
+ author = "Finegan-Dollak, Catherine
44
+ and Kummerfeld, Jonathan K.
45
+ and Zhang, Li
46
+ and Ramanathan, Karthik
47
+ and Sadasivam, Sesh
48
+ and Zhang, Rui
49
+ and Radev, Dragomir",
50
+ title = "Improving Text-to-SQL Evaluation Methodology",
51
+ booktitle = "Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)",
52
+ year = "2018",
53
+ publisher = "Association for Computational Linguistics",
54
+ pages = "351--360",
55
+ location = "Melbourne, Australia",
56
+ url = "http://aclweb.org/anthology/P18-1033"
57
+ }
58
+
59
+ @InProceedings{data-sql-imdb-yelp,
60
+ dataset = {IMDB and Yelp},
61
+ author = {Navid Yaghmazadeh, Yuepeng Wang, Isil Dillig, and Thomas Dillig},
62
+ title = {SQLizer: Query Synthesis from Natural Language},
63
+ booktitle = {International Conference on Object-Oriented Programming, Systems, Languages, and Applications, ACM},
64
+ month = {October},
65
+ year = {2017},
66
+ pages = {63:1--63:26},
67
+ url = {http://doi.org/10.1145/3133887},
68
+ }
69
+
70
+ @article{data-academic,
71
+ dataset = {Academic},
72
+ author = {Fei Li and H. V. Jagadish},
73
+ title = {Constructing an Interactive Natural Language Interface for Relational Databases},
74
+ journal = {Proceedings of the VLDB Endowment},
75
+ volume = {8},
76
+ number = {1},
77
+ month = {September},
78
+ year = {2014},
79
+ pages = {73--84},
80
+ url = {http://dx.doi.org/10.14778/2735461.2735468},
81
+ }
82
+
83
+ @InProceedings{data-atis-geography-scholar,
84
+ dataset = {Scholar, and Updated ATIS and Geography},
85
+ author = {Srinivasan Iyer, Ioannis Konstas, Alvin Cheung, Jayant Krishnamurthy, and Luke Zettlemoyer},
86
+ title = {Learning a Neural Semantic Parser from User Feedback},
87
+ booktitle = {Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
88
+ year = {2017},
89
+ pages = {963--973},
90
+ location = {Vancouver, Canada},
91
+ url = {http://www.aclweb.org/anthology/P17-1089},
92
+ }
93
+
94
+ @inproceedings{data-geography-original
95
+ dataset = {Geography, original},
96
+ author = {John M. Zelle and Raymond J. Mooney},
97
+ title = {Learning to Parse Database Queries Using Inductive Logic Programming},
98
+ booktitle = {Proceedings of the Thirteenth National Conference on Artificial Intelligence - Volume 2},
99
+ year = {1996},
100
+ pages = {1050--1055},
101
+ location = {Portland, Oregon},
102
+ url = {http://dl.acm.org/citation.cfm?id=1864519.1864543},
103
+ }
104
+
105
+ @inproceedings{data-restaurants-logic,
106
+ author = {Lappoon R. Tang and Raymond J. Mooney},
107
+ title = {Automated Construction of Database Interfaces: Intergrating Statistical and Relational Learning for Semantic Parsing},
108
+ booktitle = {2000 Joint SIGDAT Conference on Empirical Methods in Natural Language Processing and Very Large Corpora},
109
+ year = {2000},
110
+ pages = {133--141},
111
+ location = {Hong Kong, China},
112
+ url = {http://www.aclweb.org/anthology/W00-1317},
113
+ }
114
+
115
+ @inproceedings{data-restaurants-original,
116
+ author = {Ana-Maria Popescu, Oren Etzioni, and Henry Kautz},
117
+ title = {Towards a Theory of Natural Language Interfaces to Databases},
118
+ booktitle = {Proceedings of the 8th International Conference on Intelligent User Interfaces},
119
+ year = {2003},
120
+ location = {Miami, Florida, USA},
121
+ pages = {149--157},
122
+ url = {http://doi.acm.org/10.1145/604045.604070},
123
+ }
124
+
125
+ @inproceedings{data-restaurants,
126
+ author = {Alessandra Giordani and Alessandro Moschitti},
127
+ title = {Automatic Generation and Reranking of SQL-derived Answers to NL Questions},
128
+ booktitle = {Proceedings of the Second International Conference on Trustworthy Eternal Systems via Evolving Software, Data and Knowledge},
129
+ year = {2012},
130
+ location = {Montpellier, France},
131
+ pages = {59--76},
132
+ url = {https://doi.org/10.1007/978-3-642-45260-4_5},
133
+ }
database/baseball_1/schema.sql ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f2e61f0638e45f4d9f869c377b56f99f988d58f2a64999637c93691ebf2eb3a2
3
+ size 57608249
database/farm/farm.sqlite ADDED
Binary file (36.9 kB). View file
 
database/manufacturer/manufacturer.sqlite ADDED
Binary file (28.7 kB). View file
 
database/museum_visit/museum_visit.sqlite ADDED
Binary file (28.7 kB). View file
 
database/tvshow/tvshow.sqlite ADDED
Binary file (28.7 kB). View file
 
database/wta_1/wta_1.sqlite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8f20747456d7748674b4f05432f3de96446ced95b8bd5a6fd01284f6c28f727c
3
+ size 104738816
test_database/aan_1/aan_1.sqlite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:54c45e431f0f654bfac741cf69e66ca34dacf42a0d0abbde6fd426a7a1e60c4b
3
+ size 17154048
test_database/aan_1/schema.sql ADDED
The diff for this file is too large to render. See raw diff
 
test_database/allergy_1/schema.sql ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ create table Allergy_Type (
2
+ Allergy VARCHAR(20) PRIMARY KEY,
3
+ AllergyType VARCHAR(20)
4
+ );
5
+
6
+ create table Has_Allergy (
7
+ StuID INTEGER,
8
+ Allergy VARCHAR(20),
9
+ FOREIGN KEY(StuID) REFERENCES Student(StuID),
10
+ FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)
11
+ );
12
+
13
+ create table Student (
14
+ StuID INTEGER PRIMARY KEY,
15
+ LName VARCHAR(12),
16
+ Fname VARCHAR(12),
17
+ Age INTEGER,
18
+ Sex VARCHAR(1),
19
+ Major INTEGER,
20
+ Advisor INTEGER,
21
+ city_code VARCHAR(3)
22
+ );
23
+
24
+ insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
25
+ insert into Student values ( 1002, 'Kim', 'Tracy', 19, 'F', 600, 7712,'HKG');
26
+ insert into Student values ( 1003, 'Jones', 'Shiela', 21, 'F', 600, 7792,'WAS');
27
+ insert into Student values ( 1004, 'Kumar', 'Dinesh', 20, 'M', 600, 8423,'CHI');
28
+ insert into Student values ( 1005, 'Gompers', 'Paul', 26, 'M', 600, 1121,'YYZ');
29
+ insert into Student values ( 1006, 'Schultz', 'Andy', 18, 'M', 600, 1148,'BAL');
30
+ insert into Student values ( 1007, 'Apap', 'Lisa', 18, 'F', 600, 8918,'PIT');
31
+ insert into Student values ( 1008, 'Nelson', 'Jandy', 20, 'F', 600, 9172,'BAL');
32
+ insert into Student values ( 1009, 'Tai', 'Eric', 19, 'M', 600, 2192,'YYZ');
33
+ insert into Student values ( 1010, 'Lee', 'Derek', 17, 'M', 600, 2192,'HOU');
34
+ insert into Student values ( 1011, 'Adams', 'David', 22, 'M', 600, 1148,'PHL');
35
+ insert into Student values ( 1012, 'Davis', 'Steven', 20, 'M', 600, 7723,'PIT');
36
+ insert into Student values ( 1014, 'Norris', 'Charles', 18, 'M', 600, 8741, 'DAL');
37
+ insert into Student values ( 1015, 'Lee', 'Susan', 16, 'F', 600, 8721,'HKG');
38
+ insert into Student values ( 1016, 'Schwartz', 'Mark', 17, 'M', 600, 2192,'DET');
39
+ insert into Student values ( 1017, 'Wilson', 'Bruce', 27, 'M', 600, 1148,'LON');
40
+ insert into Student values ( 1018, 'Leighton', 'Michael', 20, 'M', 600, 1121, 'PIT');
41
+ insert into Student values ( 1019, 'Pang', 'Arthur', 18, 'M', 600, 2192,'WAS');
42
+ insert into Student values ( 1020, 'Thornton', 'Ian', 22, 'M', 520, 7271,'NYC');
43
+ insert into Student values ( 1021, 'Andreou', 'George', 19, 'M', 520, 8722, 'NYC');
44
+ insert into Student values ( 1022, 'Woods', 'Michael', 17, 'M', 540, 8722,'PHL');
45
+ insert into Student values ( 1023, 'Shieber', 'David', 20, 'M', 520, 8722,'NYC');
46
+ insert into Student values ( 1024, 'Prater', 'Stacy', 18, 'F', 540, 7271,'BAL');
47
+ insert into Student values ( 1025, 'Goldman', 'Mark', 18, 'M', 520, 7134,'PIT');
48
+ insert into Student values ( 1026, 'Pang', 'Eric', 19, 'M', 520, 7134,'HKG');
49
+ insert into Student values ( 1027, 'Brody', 'Paul', 18, 'M', 520, 8723,'LOS');
50
+ insert into Student values ( 1028, 'Rugh', 'Eric', 20, 'M', 550, 2311,'ROC');
51
+ insert into Student values ( 1029, 'Han', 'Jun', 17, 'M', 100, 2311,'PEK');
52
+ insert into Student values ( 1030, 'Cheng', 'Lisa', 21, 'F', 550, 2311,'SFO');
53
+ insert into Student values ( 1031, 'Smith', 'Sarah', 20, 'F', 550, 8772,'PHL');
54
+ insert into Student values ( 1032, 'Brown', 'Eric', 20, 'M', 550, 8772,'ATL');
55
+ insert into Student values ( 1033, 'Simms', 'William', 18, 'M', 550, 8772,'NAR');
56
+ insert into Student values ( 1034, 'Epp', 'Eric', 18, 'M', 050, 5718,'BOS');
57
+ insert into Student values ( 1035, 'Schmidt', 'Sarah', 26, 'F', 050, 5718,'WAS');
58
+
59
+ insert into Has_Allergy values ( 1001, 'Cat' );
60
+ insert into Has_Allergy values ( 1002, 'Shellfish' );
61
+ insert into Has_Allergy values ( 1002, 'Tree Pollen' );
62
+ insert into Has_Allergy values ( 1003, 'Dog' );
63
+ insert into Has_Allergy values ( 1004, 'Nuts' );
64
+ insert into Has_Allergy values ( 1005, 'Nuts' );
65
+ insert into Has_Allergy values ( 1005, 'Tree Pollen' );
66
+ insert into Has_Allergy values ( 1006, 'Nuts' );
67
+ insert into Has_Allergy values ( 1007, 'Ragweed' );
68
+ insert into Has_Allergy values ( 1007, 'Tree Pollen' );
69
+ insert into Has_Allergy values ( 1007, 'Grass Pollen' );
70
+ insert into Has_Allergy values ( 1007, 'Eggs' );
71
+ insert into Has_Allergy values ( 1007, 'Milk' );
72
+ insert into Has_Allergy values ( 1007, 'Shellfish' );
73
+ insert into Has_Allergy values ( 1007, 'Anchovies' );
74
+ insert into Has_Allergy values ( 1007, 'Cat' );
75
+ insert into Has_Allergy values ( 1007, 'Dog' );
76
+ insert into Has_Allergy values ( 1009, 'Tree Pollen' );
77
+ insert into Has_Allergy values ( 1010, 'Ragweed' );
78
+ insert into Has_Allergy values ( 1010, 'Tree Pollen' );
79
+ insert into Has_Allergy values ( 1010, 'Grass Pollen' );
80
+ insert into Has_Allergy values ( 1010, 'Eggs' );
81
+ insert into Has_Allergy values ( 1010, 'Milk' );
82
+ insert into Has_Allergy values ( 1010, 'Shellfish' );
83
+ insert into Has_Allergy values ( 1010, 'Anchovies' );
84
+ insert into Has_Allergy values ( 1010, 'Cat' );
85
+ insert into Has_Allergy values ( 1010, 'Dog' );
86
+ insert into Has_Allergy values ( 1011, 'Ragweed' );
87
+ insert into Has_Allergy values ( 1012, 'Ragweed' );
88
+ insert into Has_Allergy values ( 1013, 'Ragweed' );
89
+ insert into Has_Allergy values ( 1014, 'Nuts' );
90
+ insert into Has_Allergy values ( 1015, 'Nuts' );
91
+ insert into Has_Allergy values ( 1015, 'Soy' );
92
+ insert into Has_Allergy values ( 1016, 'Nuts' );
93
+ insert into Has_Allergy values ( 1016, 'Milk' );
94
+ insert into Has_Allergy values ( 1017, 'Tree Pollen' );
95
+ insert into Has_Allergy values ( 1018, 'Nuts' );
96
+ insert into Has_Allergy values ( 1018, 'Soy' );
97
+ insert into Has_Allergy values ( 1019, 'Tree Pollen' );
98
+ insert into Has_Allergy values ( 1020, 'Tree Pollen' );
99
+ insert into Has_Allergy values ( 1021, 'Tree Pollen' );
100
+ insert into Has_Allergy values ( 1022, 'Nuts' );
101
+ insert into Has_Allergy values ( 1022, 'Anchovies' );
102
+ insert into Has_Allergy values ( 1023, 'Rodent' );
103
+ insert into Has_Allergy values ( 1023, 'Cat' );
104
+ insert into Has_Allergy values ( 1023, 'Nuts' );
105
+ insert into Has_Allergy values ( 1024, 'Ragweed' );
106
+ insert into Has_Allergy values ( 1024, 'Tree Pollen' );
107
+ insert into Has_Allergy values ( 1025, 'Tree Pollen' );
108
+ insert into Has_Allergy values ( 1026, 'Grass Pollen' );
109
+ insert into Has_Allergy values ( 1027, 'Tree Pollen' );
110
+ insert into Has_Allergy values ( 1028, 'Tree Pollen' );
111
+ insert into Has_Allergy values ( 1029, 'Soy' );
112
+ insert into Has_Allergy values ( 1029, 'Nuts' );
113
+ insert into Has_Allergy values ( 1029, 'Eggs' );
114
+ insert into Has_Allergy values ( 1030, 'Grass Pollen' );
115
+ insert into Has_Allergy values ( 1031, 'Nuts' );
116
+ insert into Has_Allergy values ( 1031, 'Shellfish' );
117
+ insert into Has_Allergy values ( 1031, 'Soy' );
118
+
119
+ insert into Allergy_Type values ( 'Eggs', 'food' );
120
+ insert into Allergy_Type values ( 'Nuts', 'food' );
121
+ insert into Allergy_Type values ( 'Milk', 'food' );
122
+ insert into Allergy_Type values ( 'Shellfish', 'food' );
123
+ insert into Allergy_Type values ( 'Anchovies', 'food' );
124
+ insert into Allergy_Type values ( 'Wheat', 'food' );
125
+ insert into Allergy_Type values ( 'Soy', 'food' );
126
+ insert into Allergy_Type values ( 'Ragweed', 'environmental' );
127
+ insert into Allergy_Type values ( 'Tree Pollen', 'environmental' );
128
+ insert into Allergy_Type values ( 'Grass Pollen', 'environmental' );
129
+ insert into Allergy_Type values ( 'Cat', 'animal' );
130
+ insert into Allergy_Type values ( 'Dog', 'animal' );
131
+ insert into Allergy_Type values ( 'Rodent', 'animal' );
132
+ insert into Allergy_Type values ( 'Bee Stings', 'animal' );
test_database/apartment_rentals/schema.sql ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PRAGMA foreign_keys = ON;
2
+
3
+ CREATE TABLE Apartment_Buildings (
4
+ building_id INTEGER NOT NULL,
5
+ building_short_name CHAR(15),
6
+ building_full_name VARCHAR(80),
7
+ building_description VARCHAR(255),
8
+ building_address VARCHAR(255),
9
+ building_manager VARCHAR(50),
10
+ building_phone VARCHAR(80),
11
+ PRIMARY KEY (building_id),
12
+ UNIQUE (building_id)
13
+ );
14
+
15
+ INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (133, 'Normandie Court', 'Normandie Court', 'Studio', '7950 Casper Vista Apt. 176
16
+ Marquiseberg, CA 70496', 'Emma', '(948)040-1064x387');
17
+ INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (153, 'Mercedes House', 'Mercedes House', 'Studio', '354 Otto Villages
18
+ Charliefort, VT 71664', 'Brenden', '915-617-2408x832');
19
+ INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (191, 'The Eugene', 'The Eugene', 'Flat', '71537 Gorczany Inlet
20
+ Wisozkburgh, AL 08256', 'Melyssa', '(609)946-0491');
21
+ INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (196, 'VIA 57 WEST', 'VIA 57 WEST', 'Studio', '959 Ethel Viaduct
22
+ West Efrainburgh, DE 40074', 'Kathlyn', '681.772.2454');
23
+ INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (225, 'Columbus Square', 'Columbus Square', 'Studio', '0703 Danika Mountains Apt. 362
24
+ Mohrland, AL 56839-5028', 'Kyle', '1-724-982-9507x640');
25
+ INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (532, 'Avalon Park', 'Avalon Park', 'Duplex', '6827 Kessler Parkway Suite 908
26
+ Ahmedberg, WI 48788', 'Albert', '376-017-3538');
27
+ INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (556, 'Peter Cooper Village', 'Peter Cooper Village', 'Flat', '861 Narciso Glens Suite 392
28
+ East Ottis, ND 73970', 'Darlene', '1-224-619-0295x13195');
29
+ INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (624, 'Stuyvesant Town', 'Stuyvesant Town', 'Studio', '101 Queenie Mountains Suite 619
30
+ New Korbinmouth, KS 88726-1376', 'Marie', '(145)411-6406');
31
+ INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (644, 'The Anthem', 'The Anthem', 'Flat', '50804 Mason Isle Suite 844
32
+ West Whitney, ID 66511', 'Ewald', '(909)086-5221x3455');
33
+ INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (673, 'Barclay Tower', 'Barclay Tower', 'Flat', '1579 Runte Forges Apt. 548
34
+ Leuschkeland, OK 12009-8683', 'Rogers', '1-326-267-3386x613');
35
+ INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (734, 'Windsor Court', 'Windsor Court', 'Studio', '601 Graham Roads
36
+ Port Luz, VA 29660-6703', 'Olaf', '(480)480-7401');
37
+ INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (744, 'Silver Towers', 'Silver Towers', 'Flat', '1844 Armstrong Stravenue Suite 853
38
+ Myrnatown, CT 13528', 'Claude', '1-667-728-2287x3158');
39
+ INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (790, 'Biltmore Plaza', 'Biltmore Plaza', 'Duplex', '489 Josh Orchard Apt. 998
40
+ Sipesview, DE 69053', 'Sydni', '544-148-5565x2847');
41
+ INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (808, 'Petersfield', 'Petersfield', 'Studio', '54686 Christopher Circles Apt. 321
42
+ Daytonland, ID 88081-3991', 'Juvenal', '318-398-8140');
43
+ INSERT INTO `Apartment_Buildings` (`building_id`, `building_short_name`, `building_full_name`, `building_description`, `building_address`, `building_manager`, `building_phone`) VALUES (968, 'The Clinton', 'The Clinton', 'Flat', '012 Arnoldo Mountain
44
+ Gerholdland, ID 23342', 'Holly', '1-605-511-1973x25011');
45
+
46
+ CREATE TABLE Apartments (
47
+ apt_id INTEGER NOT NULL ,
48
+ building_id INTEGER NOT NULL,
49
+ apt_type_code CHAR(15),
50
+ apt_number CHAR(10),
51
+ bathroom_count INTEGER,
52
+ bedroom_count INTEGER,
53
+ room_count CHAR(5),
54
+ PRIMARY KEY (apt_id),
55
+ UNIQUE (apt_id),
56
+ FOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)
57
+ );
58
+ INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (1, 808, 'Flat', 'Suite 645', 1, 3, '7');
59
+ INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (2, 624, 'Flat', 'Apt. 585', 2, 4, '5');
60
+ INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (3, 225, 'Studio', 'Apt. 908', 1, 6, '7');
61
+ INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (4, 225, 'Duplex', 'Suite 749', 1, 5, '8');
62
+ INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (5, 744, 'Flat', 'Suite 307', 2, 4, '9');
63
+ INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (6, 191, 'Studio', 'Apt. 187', 3, 5, '9');
64
+ INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (7, 790, 'Studio', 'Suite 088', 2, 4, '6');
65
+ INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (8, 153, 'Flat', 'Suite 693', 2, 3, '9');
66
+ INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (9, 624, 'Studio', 'Apt. 940', 1, 4, '8');
67
+ INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (10, 225, 'Duplex', 'Apt. 859', 2, 3, '6');
68
+ INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (11, 734, 'Flat', 'Apt. 794', 1, 5, '3');
69
+ INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (12, 673, 'Duplex', 'Apt. 477', 2, 6, '3');
70
+ INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (13, 744, 'Duplex', 'Apt. 411', 2, 5, '9');
71
+ INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (14, 225, 'Flat', 'Apt. 837', 2, 4, '8');
72
+ INSERT INTO `Apartments` (`apt_id`, `building_id`, `apt_type_code`, `apt_number`, `bathroom_count`, `bedroom_count`, `room_count`) VALUES (15, 790, 'Duplex', 'Suite 634', 3, 6, '8');
73
+
74
+ CREATE TABLE Apartment_Facilities (
75
+ apt_id INTEGER NOT NULL,
76
+ facility_code CHAR(15) NOT NULL,
77
+ PRIMARY KEY (apt_id, facility_code),
78
+ FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)
79
+ );
80
+ INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (1, 'Boardband');
81
+ INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (2, 'Boardband');
82
+ INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (3, 'Gym');
83
+ INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (5, 'Swimming Pool');
84
+ INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (6, 'Cable TV');
85
+ INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (9, 'Boardband');
86
+ INSERT INTO `Apartment_Facilities` (`apt_id`, `facility_code`) VALUES (15, 'Gym');
87
+ CREATE TABLE Guests (
88
+ guest_id INTEGER NOT NULL ,
89
+ gender_code CHAR(1),
90
+ guest_first_name VARCHAR(80),
91
+ guest_last_name VARCHAR(80),
92
+ date_of_birth DATETIME,
93
+ PRIMARY KEY (guest_id),
94
+ UNIQUE (guest_id)
95
+ );
96
+
97
+ INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (1, 'Male', 'Kip', 'DuBuque', '1995-11-04 07:09:57');
98
+ INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (2, 'Unknown', 'Rebeca', 'Runolfsdottir', '1974-05-12 21:53:58');
99
+ INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (3, 'Female', 'Keon', 'Treutel', '1974-08-20 09:28:05');
100
+ INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (4, 'Female', 'Gabe', 'Bode', '2007-09-11 19:01:39');
101
+ INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (5, 'Female', 'Lou', 'Grady', '1997-01-15 17:37:40');
102
+ INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (6, 'Unknown', 'Josefina', 'Jerde', '1978-03-08 04:43:04');
103
+ INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (7, 'Female', 'Mozell', 'Toy', '1997-01-20 17:11:31');
104
+ INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (8, 'Unknown', 'Keith', 'Hoeger', '2001-06-18 20:05:55');
105
+ INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (9, 'Female', 'Crystal', 'Runolfsson', '1971-01-04 04:22:58');
106
+ INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (10, 'Female', 'Nikki', 'Lehner', '1980-06-20 18:15:39');
107
+ INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (11, 'Male', 'Gregoria', 'Schowalter', '2015-02-03 23:34:13');
108
+ INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (12, 'Male', 'Louvenia', 'Crona', '1983-08-26 15:45:08');
109
+ INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (13, 'Female', 'Else', 'Roberts', '1971-11-02 01:51:56');
110
+ INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (14, 'Female', 'Juvenal', 'Kautzer', '2003-07-29 22:08:15');
111
+ INSERT INTO `Guests` (`guest_id`, `gender_code`, `guest_first_name`, `guest_last_name`, `date_of_birth`) VALUES (15, 'Female', 'Tamia', 'Mante', '2013-02-22 11:26:22');
112
+
113
+
114
+ CREATE TABLE Apartment_Bookings (
115
+ apt_booking_id INTEGER NOT NULL,
116
+ apt_id INTEGER,
117
+ guest_id INTEGER NOT NULL,
118
+ booking_status_code CHAR(15) NOT NULL,
119
+ booking_start_date DATETIME,
120
+ booking_end_date DATETIME,
121
+ PRIMARY KEY (apt_booking_id),
122
+ UNIQUE (apt_booking_id),
123
+ FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
124
+ FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
125
+ );
126
+ CREATE TABLE View_Unit_Status (
127
+ apt_id INTEGER,
128
+ apt_booking_id INTEGER,
129
+ status_date DATETIME NOT NULL,
130
+ available_yn BIT,
131
+ PRIMARY KEY (status_date),
132
+ FOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),
133
+ FOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)
134
+ );
135
+ INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (258, 10, 2, 'Provisional', '2016-09-26 17:13:49', '2017-10-07 11:38:48');
136
+ INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (279, 15, 15, 'Provisional', '2016-04-01 06:28:08', '2017-10-25 11:08:42');
137
+ INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (337, 8, 5, 'Provisional', '2017-03-13 16:20:14', '2018-02-19 16:59:08');
138
+ INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (343, 4, 13, 'Confirmed', '2016-08-04 10:33:00', '2017-09-29 12:43:50');
139
+ INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (365, 9, 12, 'Confirmed', '2017-02-11 14:34:14', '2017-10-07 20:47:19');
140
+ INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (401, 7, 14, 'Provisional', '2016-05-24 20:09:38', '2017-10-03 01:56:21');
141
+ INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (497, 10, 8, 'Confirmed', '2016-07-25 02:57:04', '2017-09-28 11:08:15');
142
+ INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (526, 8, 7, 'Confirmed', '2016-11-26 05:04:31', '2018-02-25 15:15:37');
143
+ INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (575, 6, 3, 'Provisional', '2017-05-13 18:17:20', '2017-10-06 11:15:58');
144
+ INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (577, 12, 2, 'Provisional', '2017-03-04 02:23:49', '2018-02-06 16:57:05');
145
+ INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (623, 4, 5, 'Provisional', '2016-06-07 05:05:18', '2017-11-13 13:59:45');
146
+ INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (807, 11, 2, 'Provisional', '2016-04-17 12:53:59', '2018-03-20 17:32:58');
147
+ INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (889, 10, 4, 'Confirmed', '2016-09-28 05:00:50', '2017-09-30 18:41:04');
148
+ INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (920, 2, 2, 'Confirmed', '2017-04-07 04:53:27', '2017-11-29 12:59:42');
149
+ INSERT INTO `Apartment_Bookings` (`apt_booking_id`, `apt_id`, `guest_id`, `booking_status_code`, `booking_start_date`, `booking_end_date`) VALUES (924, 8, 3, 'Confirmed', '2017-07-03 14:15:56', '2017-11-12 01:05:09');
150
+
151
+ INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 920, '1970-09-28 10:24:29', '1');
152
+ INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (15, 575, '1972-03-23 22:55:53', '1');
153
+ INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (15, 924, '1973-10-28 04:30:14', '1');
154
+ INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (6, 497, '1976-12-18 04:03:51', '1');
155
+ INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (12, 807, '1977-04-15 13:42:19', '1');
156
+ INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (13, 575, '1978-12-28 11:53:34', '1');
157
+ INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (2, 497, '1980-11-12 13:34:45', '1');
158
+ INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (14, 401, '1985-11-05 11:46:35', '0');
159
+ INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (11, 497, '1990-11-04 17:57:50', '1');
160
+ INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (13, 337, '2000-02-04 07:50:09', '0');
161
+ INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (14, 279, '2001-02-17 20:17:09', '1');
162
+ INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (5, 337, '2003-07-25 10:13:48', '1');
163
+ INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (1, 497, '2003-08-02 08:36:36', '1');
164
+ INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (10, 497, '2006-02-23 05:50:04', '1');
165
+ INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (6, 401, '2011-02-12 09:04:07', '1');
166
+ INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (9, 623, '2011-11-06 22:08:42', '1');
167
+ INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (14, 920, '2012-11-24 13:39:37', '0');
168
+ INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (4, 258, '2014-12-10 13:53:21', '1');
169
+ INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (13, 343, '2015-06-19 07:59:01', '1');
170
+ INSERT INTO `View_Unit_Status` (`apt_id`, `apt_booking_id`, `status_date`, `available_yn`) VALUES (5, 889, '2015-07-15 11:06:29', '1');
test_database/architecture/schema.sql ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PRAGMA foreign_keys = ON;
2
+
3
+ CREATE TABLE "architect" (
4
+ "id" text,
5
+ "name" text,
6
+ "nationality" text,
7
+ "gender" text,
8
+ primary key("id")
9
+ );
10
+
11
+ CREATE TABLE "bridge" (
12
+ "architect_id" int,
13
+ "id" int,
14
+ "name" text,
15
+ "location" text,
16
+ "length_meters" real,
17
+ "length_feet" real,
18
+ primary key("id"),
19
+ foreign key ("architect_id" ) references `architect`("id")
20
+ );
21
+
22
+ CREATE TABLE "mill" (
23
+ "architect_id" int,
24
+ "id" int,
25
+ "location" text,
26
+ "name" text,
27
+ "type" text,
28
+ "built_year" int,
29
+ "notes" text,
30
+ primary key ("id"),
31
+ foreign key ("architect_id" ) references `architect`("id")
32
+ );
33
+
34
+
35
+ INSERT INTO "architect" VALUES (1, "Frank Lloyd Wright", "American", "male");
36
+ INSERT INTO "architect" VALUES (2, "Frank Gehry", "Canadian", "male");
37
+ INSERT INTO "architect" VALUES (3, "Zaha Hadid", "Iraqi, British", "female");
38
+ INSERT INTO "architect" VALUES (4, "Mies Van Der Rohe", "German, American", "male");
39
+ INSERT INTO "architect" VALUES (5, "Le Corbusier", "Swiss, French", "male");
40
+
41
+
42
+ INSERT INTO "bridge" VALUES (1,"1","Xian Ren Qiao (Fairy Bridge)","Guangxi , China","121","400");
43
+ INSERT INTO "bridge" VALUES (2,"2","Landscape Arch","Arches National Park , Utah , USA","88","290");
44
+ INSERT INTO "bridge" VALUES (3,"3","Kolob Arch","Zion National Park , Utah , USA","87","287");
45
+ INSERT INTO "bridge" VALUES (4,"4","Aloba Arch","Ennedi Plateau , Chad","76","250");
46
+ INSERT INTO "bridge" VALUES (5,"5","Morning Glory Natural Bridge","Negro Bill Canyon , Utah , USA","74","243");
47
+ INSERT INTO "bridge" VALUES (5,"6","Rainbow Bridge","Glen Canyon National Recreation Area , Utah , USA","71","234");
48
+ INSERT INTO "bridge" VALUES (4,"7","Gaotun Natural Bridge","Guizhou , China","70","230");
49
+ INSERT INTO "bridge" VALUES (3,"8","Sipapu Natural Bridge","Natural Bridges National Monument , Utah , USA","69","225");
50
+ INSERT INTO "bridge" VALUES (2,"9","Stevens Arch","Escalante Canyon , Utah , USA","67","220");
51
+ INSERT INTO "bridge" VALUES (1,"10","Shipton's Arch","Xinjiang , China","65","212");
52
+ INSERT INTO "bridge" VALUES (1,"11","Jiangzhou Arch","Guangxi , China","65","212");
53
+ INSERT INTO "bridge" VALUES (1,"12","Hazarchishma Natural Bridge","Bamiyan Province , Afghanistan","64.2","210.6");
54
+ INSERT INTO "bridge" VALUES (2,"13","Outlaw Arch","Dinosaur National Monument , Colorado , USA","63","206");
55
+ INSERT INTO "bridge" VALUES (2,"14","Snake Bridge","Sanostee , New Mexico , USA","62","204");
56
+ INSERT INTO "bridge" VALUES (5,"15","Wrather Arch","Wrather Canyon , Arizona , USA","75","246");
57
+
58
+
59
+ INSERT INTO "mill" VALUES (1,1,"Coswarem","Le Vieux Molen","Grondzeiler","1840","Molenechos (Dutch)");
60
+ INSERT INTO "mill" VALUES (1,2,"Donceel","Moulin Bertrand","Grondzeiler","1890","Molenechos (Dutch)");
61
+ INSERT INTO "mill" VALUES (2,3,"Fexhe-le-haut-Clocher","Moulin de Fexhe","Grondzeiler","1843","Molenechos (Dutch)");
62
+ INSERT INTO "mill" VALUES (3,4,"Momalle","Moulin de Momalle","Bergmolen","1850","Molenechos (Dutch)");
63
+ INSERT INTO "mill" VALUES (4,5,"Othée","Moulin du Château","Grondzeiler","1856","Molenechos (Dutch)");
64
+ INSERT INTO "mill" VALUES (4,6,"Pousset","Moulin de Pousset","Grondzeiler","1819","Molenechos (Dutch)");
65
+
test_database/assets_maintenance/assets_maintenance.sqlite ADDED
Binary file (69.6 kB). View file
 
test_database/assets_maintenance/schema.sql ADDED
@@ -0,0 +1,355 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PRAGMA foreign_keys = ON;
2
+
3
+ CREATE TABLE `Third_Party_Companies` (
4
+ `company_id` INTEGER PRIMARY KEY ,
5
+ `company_type` VARCHAR(5) NOT NULL,
6
+ `company_name` VARCHAR(255),
7
+ `company_address` VARCHAR(255),
8
+ `other_company_details` VARCHAR(255)
9
+ );
10
+
11
+ INSERT INTO Third_Party_Companies (`company_id`, `company_type`, `company_name`, `company_address`, `other_company_details`) VALUES (1, 'Maintenance Contractor', 'Langworth-Funk', '615 Jacobs Mews', 'Uganda');
12
+ INSERT INTO Third_Party_Companies (`company_id`, `company_type`, `company_name`, `company_address`, `other_company_details`) VALUES (2, 'Maintenance Contractor', 'McDermott Group', '873 Conrad Creek Apt. 286', 'China');
13
+ INSERT INTO Third_Party_Companies (`company_id`, `company_type`, `company_name`, `company_address`, `other_company_details`) VALUES (3, 'Maintenance Contractor', 'Schuppe-Carroll', '066 Bechtelar Ridge', 'United Arab Emirates');
14
+ INSERT INTO Third_Party_Companies (`company_id`, `company_type`, `company_name`, `company_address`, `other_company_details`) VALUES (4, 'Maintenance Contractor', 'Dooley-Langosh', '9576 Jacynthe Point Suite 747', 'Albania');
15
+ INSERT INTO Third_Party_Companies (`company_id`, `company_type`, `company_name`, `company_address`, `other_company_details`) VALUES (5, 'Supplier', 'Dooley and Sons', '84631 Rosenbaum Well Suite 727', 'Palestinian Territory');
16
+ INSERT INTO Third_Party_Companies (`company_id`, `company_type`, `company_name`, `company_address`, `other_company_details`) VALUES (6, 'Supplier', 'Grimes, Mosciski and Renner', '9405 Leffler Hollow Apt. 753', 'Kiribati');
17
+ INSERT INTO Third_Party_Companies (`company_id`, `company_type`, `company_name`, `company_address`, `other_company_details`) VALUES (7, 'Maintenance Contractor', 'Weimann-Swift', '016 Kaitlyn Fall Suite 236', 'Egypt');
18
+ INSERT INTO Third_Party_Companies (`company_id`, `company_type`, `company_name`, `company_address`, `other_company_details`) VALUES (8, 'Maintenance Contractor', 'Glover-Vandervort', '51515 Conn Corner Suite 696', 'Ethiopia');
19
+ INSERT INTO Third_Party_Companies (`company_id`, `company_type`, `company_name`, `company_address`, `other_company_details`) VALUES (9, 'Maintenance Contractor', 'Wisoky, Toy and Bashirian', '605 D''Amore Oval', 'Iran');
20
+ INSERT INTO Third_Party_Companies (`company_id`, `company_type`, `company_name`, `company_address`, `other_company_details`) VALUES (10, 'Maintenance Contractor', 'White Ltd', '680 Hammes Ways', 'Niue');
21
+ INSERT INTO Third_Party_Companies (`company_id`, `company_type`, `company_name`, `company_address`, `other_company_details`) VALUES (11, 'Maintenance Contractor', 'Kuvalis, Boehm and Hettinger', '99335 Cummings Square Apt. 723', 'Somalia');
22
+ INSERT INTO Third_Party_Companies (`company_id`, `company_type`, `company_name`, `company_address`, `other_company_details`) VALUES (12, 'Maintenance Contractor', 'Dicki, Erdman and Kris', '60743 Dion Harbors Suite 825', 'Western Sahara');
23
+ INSERT INTO Third_Party_Companies (`company_id`, `company_type`, `company_name`, `company_address`, `other_company_details`) VALUES (13, 'Supplier', 'Greenholt-D''Amore', '1755 Schaefer Road', 'Slovenia');
24
+ INSERT INTO Third_Party_Companies (`company_id`, `company_type`, `company_name`, `company_address`, `other_company_details`) VALUES (14, 'Supplier', 'Purdy Inc', '846 Casper Route', 'Saint Helena');
25
+ INSERT INTO Third_Party_Companies (`company_id`, `company_type`, `company_name`, `company_address`, `other_company_details`) VALUES (15, 'Maintenance Contractor', 'Rau, Ullrich and King', '5147 Raul Burg Apt. 623', 'Armenia');
26
+
27
+
28
+ CREATE TABLE `Maintenance_Contracts` (
29
+ `maintenance_contract_id` INTEGER PRIMARY KEY,
30
+ `maintenance_contract_company_id` INTEGER NOT NULL,
31
+ `contract_start_date` DATETIME,
32
+ `contract_end_date` DATETIME,
33
+ `other_contract_details` VARCHAR(255),
34
+ FOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )
35
+ );
36
+
37
+ INSERT INTO Maintenance_Contracts (`maintenance_contract_id`, `maintenance_contract_company_id`, `contract_start_date`, `contract_end_date`, `other_contract_details`) VALUES (1, 15, '2017-09-13 11:51:29', '2018-03-16 21:21:50', NULL);
38
+ INSERT INTO Maintenance_Contracts (`maintenance_contract_id`, `maintenance_contract_company_id`, `contract_start_date`, `contract_end_date`, `other_contract_details`) VALUES (2, 9, '2017-12-18 11:43:16', '2018-03-22 06:00:37', NULL);
39
+ INSERT INTO Maintenance_Contracts (`maintenance_contract_id`, `maintenance_contract_company_id`, `contract_start_date`, `contract_end_date`, `other_contract_details`) VALUES (3, 11, '2017-05-06 02:32:19', '2018-03-20 14:02:54', NULL);
40
+ INSERT INTO Maintenance_Contracts (`maintenance_contract_id`, `maintenance_contract_company_id`, `contract_start_date`, `contract_end_date`, `other_contract_details`) VALUES (4, 13, '2018-01-24 00:06:30', '2018-03-02 16:12:23', NULL);
41
+ INSERT INTO Maintenance_Contracts (`maintenance_contract_id`, `maintenance_contract_company_id`, `contract_start_date`, `contract_end_date`, `other_contract_details`) VALUES (5, 4, '2017-10-28 05:13:21', '2018-02-27 17:36:59', NULL);
42
+ INSERT INTO Maintenance_Contracts (`maintenance_contract_id`, `maintenance_contract_company_id`, `contract_start_date`, `contract_end_date`, `other_contract_details`) VALUES (6, 7, '2018-03-07 10:59:11', '2018-03-14 10:17:43', NULL);
43
+ INSERT INTO Maintenance_Contracts (`maintenance_contract_id`, `maintenance_contract_company_id`, `contract_start_date`, `contract_end_date`, `other_contract_details`) VALUES (7, 13, '2017-09-01 05:34:02', '2018-02-27 05:03:22', NULL);
44
+ INSERT INTO Maintenance_Contracts (`maintenance_contract_id`, `maintenance_contract_company_id`, `contract_start_date`, `contract_end_date`, `other_contract_details`) VALUES (8, 8, '2017-11-23 11:26:12', '2018-03-02 22:26:54', NULL);
45
+ INSERT INTO Maintenance_Contracts (`maintenance_contract_id`, `maintenance_contract_company_id`, `contract_start_date`, `contract_end_date`, `other_contract_details`) VALUES (9, 6, '2017-04-21 00:03:07', '2018-03-07 19:30:50', NULL);
46
+ INSERT INTO Maintenance_Contracts (`maintenance_contract_id`, `maintenance_contract_company_id`, `contract_start_date`, `contract_end_date`, `other_contract_details`) VALUES (10, 6, '2017-06-14 01:46:59', '2018-03-09 10:40:10', NULL);
47
+ INSERT INTO Maintenance_Contracts (`maintenance_contract_id`, `maintenance_contract_company_id`, `contract_start_date`, `contract_end_date`, `other_contract_details`) VALUES (11, 15, '2017-05-04 13:39:18', '2018-03-14 20:21:10', NULL);
48
+ INSERT INTO Maintenance_Contracts (`maintenance_contract_id`, `maintenance_contract_company_id`, `contract_start_date`, `contract_end_date`, `other_contract_details`) VALUES (12, 6, '2017-12-06 20:09:39', '2018-03-06 13:47:14', NULL);
49
+ INSERT INTO Maintenance_Contracts (`maintenance_contract_id`, `maintenance_contract_company_id`, `contract_start_date`, `contract_end_date`, `other_contract_details`) VALUES (13, 14, '2017-07-23 05:07:37', '2018-03-05 21:24:36', NULL);
50
+ INSERT INTO Maintenance_Contracts (`maintenance_contract_id`, `maintenance_contract_company_id`, `contract_start_date`, `contract_end_date`, `other_contract_details`) VALUES (14, 10, '2017-09-19 17:57:17', '2018-03-15 06:45:00', NULL);
51
+ INSERT INTO Maintenance_Contracts (`maintenance_contract_id`, `maintenance_contract_company_id`, `contract_start_date`, `contract_end_date`, `other_contract_details`) VALUES (15, 6, '2017-05-14 11:57:50', '2018-03-23 17:29:21', NULL);
52
+
53
+
54
+ CREATE TABLE `Parts` (
55
+ `part_id` INTEGER PRIMARY KEY,
56
+ `part_name` VARCHAR(255),
57
+ `chargeable_yn` VARCHAR(1),
58
+ `chargeable_amount` VARCHAR(20),
59
+ `other_part_details` VARCHAR(255)
60
+ );
61
+
62
+ INSERT INTO Parts (`part_id`, `part_name`, `chargeable_yn`, `chargeable_amount`, `other_part_details`) VALUES (1, 'top', '0', '4', NULL);
63
+ INSERT INTO Parts (`part_id`, `part_name`, `chargeable_yn`, `chargeable_amount`, `other_part_details`) VALUES (2, 'middle', '1', '9', NULL);
64
+ INSERT INTO Parts (`part_id`, `part_name`, `chargeable_yn`, `chargeable_amount`, `other_part_details`) VALUES (3, 'package', '1', '9', NULL);
65
+
66
+ CREATE TABLE `Skills` (
67
+ `skill_id` INTEGER PRIMARY KEY,
68
+ `skill_code` VARCHAR(20),
69
+ `skill_description` VARCHAR(255)
70
+ );
71
+
72
+ INSERT INTO Skills (`skill_id`, `skill_code`, `skill_description`) VALUES (1, 'ELEC', 'Electrical');
73
+ INSERT INTO Skills (`skill_id`, `skill_code`, `skill_description`) VALUES (2, 'MECH', 'Mechanical');
74
+ INSERT INTO Skills (`skill_id`, `skill_code`, `skill_description`) VALUES (3, 'TV', 'TV, Video');
75
+
76
+
77
+ CREATE TABLE `Staff` (
78
+ `staff_id` INTEGER PRIMARY KEY,
79
+ `staff_name` VARCHAR(255),
80
+ `gender` VARCHAR(1),
81
+ `other_staff_details` VARCHAR(255)
82
+ );
83
+ INSERT INTO Staff (`staff_id`, `staff_name`, `gender`, `other_staff_details`) VALUES (1, 'Audreanne', '1', 'Manager');
84
+ INSERT INTO Staff (`staff_id`, `staff_name`, `gender`, `other_staff_details`) VALUES (2, 'Berneice', '1', 'Manager');
85
+ INSERT INTO Staff (`staff_id`, `staff_name`, `gender`, `other_staff_details`) VALUES (3, 'Helena', '1', NULL);
86
+ INSERT INTO Staff (`staff_id`, `staff_name`, `gender`, `other_staff_details`) VALUES (4, 'Edmond', '0', NULL);
87
+ INSERT INTO Staff (`staff_id`, `staff_name`, `gender`, `other_staff_details`) VALUES (5, 'Leola', '1', 'Manager');
88
+ INSERT INTO Staff (`staff_id`, `staff_name`, `gender`, `other_staff_details`) VALUES (6, 'Rodger', '1', NULL);
89
+ INSERT INTO Staff (`staff_id`, `staff_name`, `gender`, `other_staff_details`) VALUES (7, 'Kadin', '1', NULL);
90
+ INSERT INTO Staff (`staff_id`, `staff_name`, `gender`, `other_staff_details`) VALUES (8, 'Christophe', '0', 'Woker');
91
+ INSERT INTO Staff (`staff_id`, `staff_name`, `gender`, `other_staff_details`) VALUES (9, 'Bernice', '0', NULL);
92
+ INSERT INTO Staff (`staff_id`, `staff_name`, `gender`, `other_staff_details`) VALUES (10, 'Jayda', '1', NULL);
93
+ INSERT INTO Staff (`staff_id`, `staff_name`, `gender`, `other_staff_details`) VALUES (11, 'Estel', '0', NULL);
94
+ INSERT INTO Staff (`staff_id`, `staff_name`, `gender`, `other_staff_details`) VALUES (12, 'Oren', '1', NULL);
95
+ INSERT INTO Staff (`staff_id`, `staff_name`, `gender`, `other_staff_details`) VALUES (13, 'Howell', '0', NULL);
96
+ INSERT INTO Staff (`staff_id`, `staff_name`, `gender`, `other_staff_details`) VALUES (14, 'Cyrus', '0', NULL);
97
+ INSERT INTO Staff (`staff_id`, `staff_name`, `gender`, `other_staff_details`) VALUES (15, 'Jeffry', '0', NULL);
98
+
99
+
100
+
101
+ CREATE TABLE `Assets` (
102
+ `asset_id` INTEGER PRIMARY KEY,
103
+ `maintenance_contract_id` INTEGER NOT NULL,
104
+ `supplier_company_id` INTEGER NOT NULL,
105
+ `asset_details` VARCHAR(255),
106
+ `asset_make` VARCHAR(20),
107
+ `asset_model` VARCHAR(20),
108
+ `asset_acquired_date` DATETIME,
109
+ `asset_disposed_date` DATETIME,
110
+ `other_asset_details` VARCHAR(255),
111
+ FOREIGN KEY (`maintenance_contract_id` )
112
+ REFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),
113
+ FOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )
114
+ );
115
+
116
+
117
+
118
+ INSERT INTO Assets (`asset_id`, `maintenance_contract_id`, `supplier_company_id`, `asset_details`, `asset_make`, `asset_model`, `asset_acquired_date`, `asset_disposed_date`, `other_asset_details`) VALUES (1, 2, 2, 'dell laptop1', 'PT', '58 ub', '2017-12-25 00:31:27', '2018-03-14 10:50:00', NULL);
119
+ INSERT INTO Assets (`asset_id`, `maintenance_contract_id`, `supplier_company_id`, `asset_details`, `asset_make`, `asset_model`, `asset_acquired_date`, `asset_disposed_date`, `other_asset_details`) VALUES (2, 14, 1, 'dell laptop2', 'IN', '35 xt', '2018-01-27 00:59:46', '2018-03-20 04:24:09', NULL);
120
+ INSERT INTO Assets (`asset_id`, `maintenance_contract_id`, `supplier_company_id`, `asset_details`, `asset_make`, `asset_model`, `asset_acquired_date`, `asset_disposed_date`, `other_asset_details`) VALUES (3, 7, 2, 'dell laptop3', 'IT', '63 ok', '2017-09-07 08:13:15', '2018-03-08 20:50:40', 'Bad condition');
121
+ INSERT INTO Assets (`asset_id`, `maintenance_contract_id`, `supplier_company_id`, `asset_details`, `asset_make`, `asset_model`, `asset_acquired_date`, `asset_disposed_date`, `other_asset_details`) VALUES (4, 11, 5, 'dell laptop4', 'RU', '69 uv', '2017-06-12 17:37:19', '2018-03-16 05:46:55', NULL);
122
+ INSERT INTO Assets (`asset_id`, `maintenance_contract_id`, `supplier_company_id`, `asset_details`, `asset_make`, `asset_model`, `asset_acquired_date`, `asset_disposed_date`, `other_asset_details`) VALUES (5, 8, 5, 'dell laptop5', 'DE', '90 oq', '2017-07-21 16:03:19', '2018-02-27 18:59:07', NULL);
123
+ INSERT INTO Assets (`asset_id`, `maintenance_contract_id`, `supplier_company_id`, `asset_details`, `asset_make`, `asset_model`, `asset_acquired_date`, `asset_disposed_date`, `other_asset_details`) VALUES (6, 8, 6, 'monitor1', 'CN', '91 ub', '2017-04-22 12:33:39', '2018-03-10 11:11:43', NULL);
124
+ INSERT INTO Assets (`asset_id`, `maintenance_contract_id`, `supplier_company_id`, `asset_details`, `asset_make`, `asset_model`, `asset_acquired_date`, `asset_disposed_date`, `other_asset_details`) VALUES (7, 6, 6, 'monitor2', 'CN', '27 du', '2017-07-18 01:22:58', '2018-03-20 22:45:00', NULL);
125
+ INSERT INTO Assets (`asset_id`, `maintenance_contract_id`, `supplier_company_id`, `asset_details`, `asset_make`, `asset_model`, `asset_acquired_date`, `asset_disposed_date`, `other_asset_details`) VALUES (8, 15, 7, 'monitor3', 'GB', '94 kg', '2017-10-24 04:29:17', '2018-02-28 18:14:13', 'Bad condition');
126
+ INSERT INTO Assets (`asset_id`, `maintenance_contract_id`, `supplier_company_id`, `asset_details`, `asset_make`, `asset_model`, `asset_acquired_date`, `asset_disposed_date`, `other_asset_details`) VALUES (9, 12, 13, 'machine1', 'RU', '07 yt', '2017-04-16 12:19:25', '2018-03-08 18:42:41', NULL);
127
+ INSERT INTO Assets (`asset_id`, `maintenance_contract_id`, `supplier_company_id`, `asset_details`, `asset_make`, `asset_model`, `asset_acquired_date`, `asset_disposed_date`, `other_asset_details`) VALUES (10, 2, 2, 'machine2', 'FR', '20 tl', '2017-09-19 16:15:45', '2018-03-06 20:36:14', NULL);
128
+ INSERT INTO Assets (`asset_id`, `maintenance_contract_id`, `supplier_company_id`, `asset_details`, `asset_make`, `asset_model`, `asset_acquired_date`, `asset_disposed_date`, `other_asset_details`) VALUES (11, 7, 12, 'machine3', 'FR', '11 wi', '2017-11-25 05:04:20', '2018-03-17 00:51:14', NULL);
129
+ INSERT INTO Assets (`asset_id`, `maintenance_contract_id`, `supplier_company_id`, `asset_details`, `asset_make`, `asset_model`, `asset_acquired_date`, `asset_disposed_date`, `other_asset_details`) VALUES (12, 13, 14, 'machine4', 'RU', '95 vn', '2017-09-26 14:05:46', '2018-02-27 23:12:03', 'Bad condition');
130
+ INSERT INTO Assets (`asset_id`, `maintenance_contract_id`, `supplier_company_id`, `asset_details`, `asset_make`, `asset_model`, `asset_acquired_date`, `asset_disposed_date`, `other_asset_details`) VALUES (13, 11, 8, 'system1', 'DE', '08 yy', '2017-12-20 14:05:17', '2018-03-07 20:35:19', 'Bad condition');
131
+ INSERT INTO Assets (`asset_id`, `maintenance_contract_id`, `supplier_company_id`, `asset_details`, `asset_make`, `asset_model`, `asset_acquired_date`, `asset_disposed_date`, `other_asset_details`) VALUES (14, 10, 6, 'system2', 'IN', '66 xm', '2017-10-19 02:54:52', '2018-03-22 23:48:15', NULL);
132
+ INSERT INTO Assets (`asset_id`, `maintenance_contract_id`, `supplier_company_id`, `asset_details`, `asset_make`, `asset_model`, `asset_acquired_date`, `asset_disposed_date`, `other_asset_details`) VALUES (15, 6, 11, 'system3', 'IE', '24 ak', '2017-12-18 19:21:11', '2018-02-27 02:37:16', NULL);
133
+
134
+
135
+
136
+ CREATE TABLE `Asset_Parts` (
137
+ `asset_id` INTEGER NOT NULL,
138
+ `part_id` INTEGER NOT NULL,
139
+ FOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),
140
+ FOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )
141
+ );
142
+
143
+ INSERT INTO Asset_Parts (`asset_id`, `part_id`) VALUES (5, 3);
144
+ INSERT INTO Asset_Parts (`asset_id`, `part_id`) VALUES (3, 3);
145
+ INSERT INTO Asset_Parts (`asset_id`, `part_id`) VALUES (10, 1);
146
+ INSERT INTO Asset_Parts (`asset_id`, `part_id`) VALUES (1, 2);
147
+ INSERT INTO Asset_Parts (`asset_id`, `part_id`) VALUES (3, 1);
148
+ INSERT INTO Asset_Parts (`asset_id`, `part_id`) VALUES (1, 3);
149
+ INSERT INTO Asset_Parts (`asset_id`, `part_id`) VALUES (6, 2);
150
+ INSERT INTO Asset_Parts (`asset_id`, `part_id`) VALUES (2, 3);
151
+ INSERT INTO Asset_Parts (`asset_id`, `part_id`) VALUES (3, 2);
152
+ INSERT INTO Asset_Parts (`asset_id`, `part_id`) VALUES (2, 2);
153
+ INSERT INTO Asset_Parts (`asset_id`, `part_id`) VALUES (3, 3);
154
+ INSERT INTO Asset_Parts (`asset_id`, `part_id`) VALUES (15, 3);
155
+ INSERT INTO Asset_Parts (`asset_id`, `part_id`) VALUES (4, 1);
156
+ INSERT INTO Asset_Parts (`asset_id`, `part_id`) VALUES (14, 1);
157
+ INSERT INTO Asset_Parts (`asset_id`, `part_id`) VALUES (15, 2);
158
+
159
+
160
+
161
+ CREATE TABLE `Maintenance_Engineers` (
162
+ `engineer_id` INTEGER PRIMARY KEY,
163
+ `company_id` INTEGER NOT NULL,
164
+ `first_name` VARCHAR(50),
165
+ `last_name` VARCHAR(50),
166
+ `other_details` VARCHAR(255),
167
+ FOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )
168
+ );
169
+
170
+
171
+ INSERT INTO Maintenance_Engineers (`engineer_id`, `company_id`, `first_name`, `last_name`, `other_details`) VALUES (1, 14, 'Etha', 'Reinger', 'Skilled');
172
+ INSERT INTO Maintenance_Engineers (`engineer_id`, `company_id`, `first_name`, `last_name`, `other_details`) VALUES (2, 2, 'Clemens', 'Orn', NULL);
173
+ INSERT INTO Maintenance_Engineers (`engineer_id`, `company_id`, `first_name`, `last_name`, `other_details`) VALUES (3, 6, 'Samanta', 'Hauck', NULL);
174
+ INSERT INTO Maintenance_Engineers (`engineer_id`, `company_id`, `first_name`, `last_name`, `other_details`) VALUES (4, 3, 'Lorine', 'Morar', NULL);
175
+ INSERT INTO Maintenance_Engineers (`engineer_id`, `company_id`, `first_name`, `last_name`, `other_details`) VALUES (5, 15, 'Manley', 'Grady', NULL);
176
+ INSERT INTO Maintenance_Engineers (`engineer_id`, `company_id`, `first_name`, `last_name`, `other_details`) VALUES (6, 1, 'Courtney', 'Adams', NULL);
177
+ INSERT INTO Maintenance_Engineers (`engineer_id`, `company_id`, `first_name`, `last_name`, `other_details`) VALUES (7, 11, 'Josie', 'Harvey', 'Skilled');
178
+ INSERT INTO Maintenance_Engineers (`engineer_id`, `company_id`, `first_name`, `last_name`, `other_details`) VALUES (8, 9, 'Nellie', 'Hirthe', NULL);
179
+ INSERT INTO Maintenance_Engineers (`engineer_id`, `company_id`, `first_name`, `last_name`, `other_details`) VALUES (9, 4, 'Brian', 'Stamm', NULL);
180
+ INSERT INTO Maintenance_Engineers (`engineer_id`, `company_id`, `first_name`, `last_name`, `other_details`) VALUES (10, 4, 'Naomi', 'Price', NULL);
181
+ INSERT INTO Maintenance_Engineers (`engineer_id`, `company_id`, `first_name`, `last_name`, `other_details`) VALUES (11, 7, 'Cullen', 'Kunde', NULL);
182
+ INSERT INTO Maintenance_Engineers (`engineer_id`, `company_id`, `first_name`, `last_name`, `other_details`) VALUES (12, 10, 'Alexys', 'Simonis', NULL);
183
+ INSERT INTO Maintenance_Engineers (`engineer_id`, `company_id`, `first_name`, `last_name`, `other_details`) VALUES (13, 2, 'Weston', 'Hahn', NULL);
184
+ INSERT INTO Maintenance_Engineers (`engineer_id`, `company_id`, `first_name`, `last_name`, `other_details`) VALUES (14, 11, 'Jules', 'Goldner', NULL);
185
+ INSERT INTO Maintenance_Engineers (`engineer_id`, `company_id`, `first_name`, `last_name`, `other_details`) VALUES (15, 3, 'Archibald', 'Streich', NULL);
186
+
187
+
188
+
189
+ CREATE TABLE `Engineer_Skills` (
190
+ `engineer_id` INTEGER NOT NULL,
191
+ `skill_id` INTEGER NOT NULL,
192
+ FOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),
193
+ FOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )
194
+ );
195
+
196
+ INSERT INTO Engineer_Skills (`engineer_id`, `skill_id`) VALUES (10, 2);
197
+ INSERT INTO Engineer_Skills (`engineer_id`, `skill_id`) VALUES (10, 1);
198
+ INSERT INTO Engineer_Skills (`engineer_id`, `skill_id`) VALUES (15, 1);
199
+ INSERT INTO Engineer_Skills (`engineer_id`, `skill_id`) VALUES (6, 1);
200
+ INSERT INTO Engineer_Skills (`engineer_id`, `skill_id`) VALUES (13, 1);
201
+ INSERT INTO Engineer_Skills (`engineer_id`, `skill_id`) VALUES (6, 3);
202
+ INSERT INTO Engineer_Skills (`engineer_id`, `skill_id`) VALUES (13, 2);
203
+ INSERT INTO Engineer_Skills (`engineer_id`, `skill_id`) VALUES (7, 3);
204
+ INSERT INTO Engineer_Skills (`engineer_id`, `skill_id`) VALUES (5, 2);
205
+ INSERT INTO Engineer_Skills (`engineer_id`, `skill_id`) VALUES (8, 3);
206
+ INSERT INTO Engineer_Skills (`engineer_id`, `skill_id`) VALUES (15, 3);
207
+ INSERT INTO Engineer_Skills (`engineer_id`, `skill_id`) VALUES (5, 1);
208
+ INSERT INTO Engineer_Skills (`engineer_id`, `skill_id`) VALUES (9, 3);
209
+ INSERT INTO Engineer_Skills (`engineer_id`, `skill_id`) VALUES (3, 1);
210
+ INSERT INTO Engineer_Skills (`engineer_id`, `skill_id`) VALUES (11, 2);
211
+ INSERT INTO Engineer_Skills (`engineer_id`, `skill_id`) VALUES (12, 2);
212
+ INSERT INTO Engineer_Skills (`engineer_id`, `skill_id`) VALUES (2, 2);
213
+ INSERT INTO Engineer_Skills (`engineer_id`, `skill_id`) VALUES (10, 1);
214
+ INSERT INTO Engineer_Skills (`engineer_id`, `skill_id`) VALUES (8, 1);
215
+ INSERT INTO Engineer_Skills (`engineer_id`, `skill_id`) VALUES (4, 1);
216
+
217
+ CREATE TABLE `Fault_Log` (
218
+ `fault_log_entry_id` INTEGER PRIMARY KEY,
219
+ `asset_id` INTEGER NOT NULL,
220
+ `recorded_by_staff_id` INTEGER NOT NULL,
221
+ `fault_log_entry_datetime` DATETIME,
222
+ `fault_description` VARCHAR(255),
223
+ `other_fault_details` VARCHAR(255),
224
+ FOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),
225
+ FOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )
226
+ );
227
+
228
+ INSERT INTO Fault_Log (`fault_log_entry_id`, `asset_id`, `recorded_by_staff_id`, `fault_log_entry_datetime`, `fault_description`, `other_fault_details`) VALUES (1, 3, 14, '2018-03-21 04:25:00', 'system error', NULL);
229
+ INSERT INTO Fault_Log (`fault_log_entry_id`, `asset_id`, `recorded_by_staff_id`, `fault_log_entry_datetime`, `fault_description`, `other_fault_details`) VALUES (2, 7, 4, '2018-03-13 09:43:05', 'system error', NULL);
230
+ INSERT INTO Fault_Log (`fault_log_entry_id`, `asset_id`, `recorded_by_staff_id`, `fault_log_entry_datetime`, `fault_description`, `other_fault_details`) VALUES (3, 6, 9, '2018-02-24 09:28:20', 'system error', NULL);
231
+ INSERT INTO Fault_Log (`fault_log_entry_id`, `asset_id`, `recorded_by_staff_id`, `fault_log_entry_datetime`, `fault_description`, `other_fault_details`) VALUES (4, 5, 13, '2018-02-28 02:07:36', 'failed parts', NULL);
232
+ INSERT INTO Fault_Log (`fault_log_entry_id`, `asset_id`, `recorded_by_staff_id`, `fault_log_entry_datetime`, `fault_description`, `other_fault_details`) VALUES (5, 9, 11, '2018-03-02 03:14:46', 'system error', NULL);
233
+ INSERT INTO Fault_Log (`fault_log_entry_id`, `asset_id`, `recorded_by_staff_id`, `fault_log_entry_datetime`, `fault_description`, `other_fault_details`) VALUES (6, 8, 8, '2018-02-28 20:15:25', 'failed parts', NULL);
234
+ INSERT INTO Fault_Log (`fault_log_entry_id`, `asset_id`, `recorded_by_staff_id`, `fault_log_entry_datetime`, `fault_description`, `other_fault_details`) VALUES (7, 5, 14, '2018-03-05 09:44:08', 'system error', NULL);
235
+ INSERT INTO Fault_Log (`fault_log_entry_id`, `asset_id`, `recorded_by_staff_id`, `fault_log_entry_datetime`, `fault_description`, `other_fault_details`) VALUES (8, 12, 10, '2018-03-19 04:24:18', 'failed parts', NULL);
236
+ INSERT INTO Fault_Log (`fault_log_entry_id`, `asset_id`, `recorded_by_staff_id`, `fault_log_entry_datetime`, `fault_description`, `other_fault_details`) VALUES (9, 3, 5, '2018-03-06 15:52:54', 'system error', NULL);
237
+ INSERT INTO Fault_Log (`fault_log_entry_id`, `asset_id`, `recorded_by_staff_id`, `fault_log_entry_datetime`, `fault_description`, `other_fault_details`) VALUES (10, 2, 9, '2018-03-03 10:41:52', 'failed parts', NULL);
238
+ INSERT INTO Fault_Log (`fault_log_entry_id`, `asset_id`, `recorded_by_staff_id`, `fault_log_entry_datetime`, `fault_description`, `other_fault_details`) VALUES (11, 15, 12, '2018-03-21 15:02:17', 'failed parts', NULL);
239
+ INSERT INTO Fault_Log (`fault_log_entry_id`, `asset_id`, `recorded_by_staff_id`, `fault_log_entry_datetime`, `fault_description`, `other_fault_details`) VALUES (12, 8, 8, '2018-03-10 07:08:34', 'system error', NULL);
240
+ INSERT INTO Fault_Log (`fault_log_entry_id`, `asset_id`, `recorded_by_staff_id`, `fault_log_entry_datetime`, `fault_description`, `other_fault_details`) VALUES (13, 3, 13, '2018-03-11 14:00:39', 'system error', NULL);
241
+ INSERT INTO Fault_Log (`fault_log_entry_id`, `asset_id`, `recorded_by_staff_id`, `fault_log_entry_datetime`, `fault_description`, `other_fault_details`) VALUES (14, 3, 11, '2018-02-27 11:34:20', 'failed parts', NULL);
242
+ INSERT INTO Fault_Log (`fault_log_entry_id`, `asset_id`, `recorded_by_staff_id`, `fault_log_entry_datetime`, `fault_description`, `other_fault_details`) VALUES (15, 12, 13, '2018-03-01 08:52:58', 'system error', NULL);
243
+
244
+ CREATE TABLE `Engineer_Visits` (
245
+ `engineer_visit_id` INTEGER PRIMARY KEY,
246
+ `contact_staff_id` INTEGER,
247
+ `engineer_id` INTEGER NOT NULL,
248
+ `fault_log_entry_id` INTEGER NOT NULL,
249
+ `fault_status` VARCHAR(10) NOT NULL,
250
+ `visit_start_datetime` DATETIME,
251
+ `visit_end_datetime` DATETIME,
252
+ `other_visit_details` VARCHAR(255),
253
+ FOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),
254
+ FOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),
255
+ FOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )
256
+ );
257
+
258
+
259
+
260
+ INSERT INTO Engineer_Visits (`engineer_visit_id`, `contact_staff_id`, `engineer_id`, `fault_log_entry_id`, `fault_status`, `visit_start_datetime`, `visit_end_datetime`, `other_visit_details`) VALUES (1, 8, 8, 13, 'Waiting', '1978-10-12 23:14:40', '1988-01-07 06:41:51', NULL);
261
+ INSERT INTO Engineer_Visits (`engineer_visit_id`, `contact_staff_id`, `engineer_id`, `fault_log_entry_id`, `fault_status`, `visit_start_datetime`, `visit_end_datetime`, `other_visit_details`) VALUES (2, 7, 15, 13, 'Return', '1980-05-02 23:31:18', '1990-08-30 22:44:16', NULL);
262
+ INSERT INTO Engineer_Visits (`engineer_visit_id`, `contact_staff_id`, `engineer_id`, `fault_log_entry_id`, `fault_status`, `visit_start_datetime`, `visit_end_datetime`, `other_visit_details`) VALUES (3, 7, 15, 4, 'Waiting', '2010-02-23 18:16:23', '1982-05-13 02:08:41', NULL);
263
+ INSERT INTO Engineer_Visits (`engineer_visit_id`, `contact_staff_id`, `engineer_id`, `fault_log_entry_id`, `fault_status`, `visit_start_datetime`, `visit_end_datetime`, `other_visit_details`) VALUES (4, 12, 12, 13, 'Fixed', '1996-11-07 05:31:35', '1973-09-12 07:06:54', NULL);
264
+ INSERT INTO Engineer_Visits (`engineer_visit_id`, `contact_staff_id`, `engineer_id`, `fault_log_entry_id`, `fault_status`, `visit_start_datetime`, `visit_end_datetime`, `other_visit_details`) VALUES (5, 2, 4, 12, 'Fixed', '1994-07-27 22:35:48', '2008-03-24 22:18:47', NULL);
265
+ INSERT INTO Engineer_Visits (`engineer_visit_id`, `contact_staff_id`, `engineer_id`, `fault_log_entry_id`, `fault_status`, `visit_start_datetime`, `visit_end_datetime`, `other_visit_details`) VALUES (6, 4, 15, 11, 'Fixed', '1984-07-14 22:47:51', '2010-07-05 18:36:22', NULL);
266
+ INSERT INTO Engineer_Visits (`engineer_visit_id`, `contact_staff_id`, `engineer_id`, `fault_log_entry_id`, `fault_status`, `visit_start_datetime`, `visit_end_datetime`, `other_visit_details`) VALUES (7, 7, 15, 14, 'Reported', '1996-07-06 23:59:49', '2012-11-27 06:26:01', NULL);
267
+ INSERT INTO Engineer_Visits (`engineer_visit_id`, `contact_staff_id`, `engineer_id`, `fault_log_entry_id`, `fault_status`, `visit_start_datetime`, `visit_end_datetime`, `other_visit_details`) VALUES (8, 6, 15, 2, 'Waiting', '1985-08-26 01:02:49', '1971-03-29 23:46:30', NULL);
268
+ INSERT INTO Engineer_Visits (`engineer_visit_id`, `contact_staff_id`, `engineer_id`, `fault_log_entry_id`, `fault_status`, `visit_start_datetime`, `visit_end_datetime`, `other_visit_details`) VALUES (9, 7, 15, 12, 'Waiting', '1991-05-02 01:39:59', '1970-08-01 15:35:51', NULL);
269
+ INSERT INTO Engineer_Visits (`engineer_visit_id`, `contact_staff_id`, `engineer_id`, `fault_log_entry_id`, `fault_status`, `visit_start_datetime`, `visit_end_datetime`, `other_visit_details`) VALUES (10, 14, 10, 2, 'Fixed', '1996-07-12 22:38:46', '1970-03-25 14:44:29', NULL);
270
+ INSERT INTO Engineer_Visits (`engineer_visit_id`, `contact_staff_id`, `engineer_id`, `fault_log_entry_id`, `fault_status`, `visit_start_datetime`, `visit_end_datetime`, `other_visit_details`) VALUES (11, 9, 6, 3, 'Fixed', '1975-04-06 11:09:23', '2000-01-27 09:33:10', NULL);
271
+ INSERT INTO Engineer_Visits (`engineer_visit_id`, `contact_staff_id`, `engineer_id`, `fault_log_entry_id`, `fault_status`, `visit_start_datetime`, `visit_end_datetime`, `other_visit_details`) VALUES (12, 2, 1, 13, 'Return', '2006-03-31 20:03:10', '2013-09-29 20:50:24', NULL);
272
+ INSERT INTO Engineer_Visits (`engineer_visit_id`, `contact_staff_id`, `engineer_id`, `fault_log_entry_id`, `fault_status`, `visit_start_datetime`, `visit_end_datetime`, `other_visit_details`) VALUES (13, 4, 10, 8, 'Fixed', '2015-07-05 21:37:55', '1988-10-20 12:02:00', NULL);
273
+ INSERT INTO Engineer_Visits (`engineer_visit_id`, `contact_staff_id`, `engineer_id`, `fault_log_entry_id`, `fault_status`, `visit_start_datetime`, `visit_end_datetime`, `other_visit_details`) VALUES (14, 9, 4, 13, 'Return', '1997-06-23 17:45:21', '1980-12-19 08:30:46', NULL);
274
+ INSERT INTO Engineer_Visits (`engineer_visit_id`, `contact_staff_id`, `engineer_id`, `fault_log_entry_id`, `fault_status`, `visit_start_datetime`, `visit_end_datetime`, `other_visit_details`) VALUES (15, 4, 11, 10, 'Reported', '1970-07-19 19:21:32', '2007-11-12 04:24:01', NULL);
275
+
276
+
277
+
278
+ CREATE TABLE `Part_Faults` (
279
+ `part_fault_id` INTEGER PRIMARY KEY,
280
+ `part_id` INTEGER NOT NULL,
281
+ `fault_short_name` VARCHAR(20),
282
+ `fault_description` VARCHAR(255),
283
+ `other_fault_details` VARCHAR(255),
284
+ FOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )
285
+ );
286
+
287
+
288
+ CREATE TABLE `Fault_Log_Parts` (
289
+ `fault_log_entry_id` INTEGER NOT NULL,
290
+ `part_fault_id` INTEGER NOT NULL,
291
+ `fault_status` VARCHAR(10) NOT NULL,
292
+ FOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),
293
+ FOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )
294
+ );
295
+
296
+ INSERT INTO Part_Faults (`part_fault_id`, `part_id`, `fault_short_name`, `fault_description`, `other_fault_details`) VALUES (1, 1, 'PW', 'Package Wrong', NULL);
297
+ INSERT INTO Part_Faults (`part_fault_id`, `part_id`, `fault_short_name`, `fault_description`, `other_fault_details`) VALUES (2, 1, 'PW', 'Package Wrong', NULL);
298
+ INSERT INTO Part_Faults (`part_fault_id`, `part_id`, `fault_short_name`, `fault_description`, `other_fault_details`) VALUES (3, 3, 'TW', 'Top Parts Wrong', NULL);
299
+ INSERT INTO Part_Faults (`part_fault_id`, `part_id`, `fault_short_name`, `fault_description`, `other_fault_details`) VALUES (4, 1, 'PW', 'Package Wrong', NULL);
300
+ INSERT INTO Part_Faults (`part_fault_id`, `part_id`, `fault_short_name`, `fault_description`, `other_fault_details`) VALUES (5, 1, 'MW', 'Medium Scale Wrong', NULL);
301
+ INSERT INTO Part_Faults (`part_fault_id`, `part_id`, `fault_short_name`, `fault_description`, `other_fault_details`) VALUES (6, 2, 'PW', 'Package Wrong', NULL);
302
+ INSERT INTO Part_Faults (`part_fault_id`, `part_id`, `fault_short_name`, `fault_description`, `other_fault_details`) VALUES (7, 1, 'PW', 'Package Wrong', NULL);
303
+ INSERT INTO Part_Faults (`part_fault_id`, `part_id`, `fault_short_name`, `fault_description`, `other_fault_details`) VALUES (8, 3, 'TW', 'Top Parts Wrong', NULL);
304
+ INSERT INTO Part_Faults (`part_fault_id`, `part_id`, `fault_short_name`, `fault_description`, `other_fault_details`) VALUES (9, 3, 'PW', 'Package Wrong', NULL);
305
+ INSERT INTO Part_Faults (`part_fault_id`, `part_id`, `fault_short_name`, `fault_description`, `other_fault_details`) VALUES (10, 1, 'PW', 'Package Wrong', NULL);
306
+ INSERT INTO Part_Faults (`part_fault_id`, `part_id`, `fault_short_name`, `fault_description`, `other_fault_details`) VALUES (11, 3, 'MW', 'Medium Scale Wrong', NULL);
307
+ INSERT INTO Part_Faults (`part_fault_id`, `part_id`, `fault_short_name`, `fault_description`, `other_fault_details`) VALUES (12, 2, 'MW', 'Medium Scale Wrong', NULL);
308
+ INSERT INTO Part_Faults (`part_fault_id`, `part_id`, `fault_short_name`, `fault_description`, `other_fault_details`) VALUES (13, 3, 'TW', 'Top Parts Wrong', NULL);
309
+ INSERT INTO Part_Faults (`part_fault_id`, `part_id`, `fault_short_name`, `fault_description`, `other_fault_details`) VALUES (14, 1, 'TW', 'Top Parts Wrong', NULL);
310
+ INSERT INTO Part_Faults (`part_fault_id`, `part_id`, `fault_short_name`, `fault_description`, `other_fault_details`) VALUES (15, 3, 'MW', 'Medium Scale Wrong', NULL);
311
+
312
+
313
+
314
+ INSERT INTO Fault_Log_Parts (`fault_log_entry_id`, `part_fault_id`, `fault_status`) VALUES (12, 3, 'Reported');
315
+ INSERT INTO Fault_Log_Parts (`fault_log_entry_id`, `part_fault_id`, `fault_status`) VALUES (7, 4, 'Reported');
316
+ INSERT INTO Fault_Log_Parts (`fault_log_entry_id`, `part_fault_id`, `fault_status`) VALUES (1, 9, 'Return');
317
+ INSERT INTO Fault_Log_Parts (`fault_log_entry_id`, `part_fault_id`, `fault_status`) VALUES (1, 14, 'Fixed');
318
+ INSERT INTO Fault_Log_Parts (`fault_log_entry_id`, `part_fault_id`, `fault_status`) VALUES (6, 4, 'Waiting');
319
+ INSERT INTO Fault_Log_Parts (`fault_log_entry_id`, `part_fault_id`, `fault_status`) VALUES (14, 8, 'Waiting');
320
+ INSERT INTO Fault_Log_Parts (`fault_log_entry_id`, `part_fault_id`, `fault_status`) VALUES (1, 10, 'Fixed');
321
+ INSERT INTO Fault_Log_Parts (`fault_log_entry_id`, `part_fault_id`, `fault_status`) VALUES (3, 8, 'Return');
322
+ INSERT INTO Fault_Log_Parts (`fault_log_entry_id`, `part_fault_id`, `fault_status`) VALUES (11, 2, 'Reported');
323
+ INSERT INTO Fault_Log_Parts (`fault_log_entry_id`, `part_fault_id`, `fault_status`) VALUES (3, 11, 'Fixed');
324
+ INSERT INTO Fault_Log_Parts (`fault_log_entry_id`, `part_fault_id`, `fault_status`) VALUES (11, 8, 'Reported');
325
+ INSERT INTO Fault_Log_Parts (`fault_log_entry_id`, `part_fault_id`, `fault_status`) VALUES (4, 14, 'Waiting');
326
+ INSERT INTO Fault_Log_Parts (`fault_log_entry_id`, `part_fault_id`, `fault_status`) VALUES (13, 15, 'Fixed');
327
+ INSERT INTO Fault_Log_Parts (`fault_log_entry_id`, `part_fault_id`, `fault_status`) VALUES (13, 1, 'Fixed');
328
+ INSERT INTO Fault_Log_Parts (`fault_log_entry_id`, `part_fault_id`, `fault_status`) VALUES (4, 6, 'Reported');
329
+
330
+
331
+ CREATE TABLE `Skills_Required_To_Fix` (
332
+ `part_fault_id` INTEGER NOT NULL,
333
+ `skill_id` INTEGER NOT NULL,
334
+ FOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),
335
+ FOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )
336
+ );
337
+
338
+
339
+
340
+
341
+ INSERT INTO Skills_Required_To_Fix (`part_fault_id`, `skill_id`) VALUES (3, 2);
342
+ INSERT INTO Skills_Required_To_Fix (`part_fault_id`, `skill_id`) VALUES (12, 3);
343
+ INSERT INTO Skills_Required_To_Fix (`part_fault_id`, `skill_id`) VALUES (6, 1);
344
+ INSERT INTO Skills_Required_To_Fix (`part_fault_id`, `skill_id`) VALUES (15, 3);
345
+ INSERT INTO Skills_Required_To_Fix (`part_fault_id`, `skill_id`) VALUES (1, 3);
346
+ INSERT INTO Skills_Required_To_Fix (`part_fault_id`, `skill_id`) VALUES (1, 1);
347
+ INSERT INTO Skills_Required_To_Fix (`part_fault_id`, `skill_id`) VALUES (5, 3);
348
+ INSERT INTO Skills_Required_To_Fix (`part_fault_id`, `skill_id`) VALUES (13, 2);
349
+ INSERT INTO Skills_Required_To_Fix (`part_fault_id`, `skill_id`) VALUES (14, 3);
350
+ INSERT INTO Skills_Required_To_Fix (`part_fault_id`, `skill_id`) VALUES (10, 2);
351
+ INSERT INTO Skills_Required_To_Fix (`part_fault_id`, `skill_id`) VALUES (2, 1);
352
+ INSERT INTO Skills_Required_To_Fix (`part_fault_id`, `skill_id`) VALUES (7, 2);
353
+ INSERT INTO Skills_Required_To_Fix (`part_fault_id`, `skill_id`) VALUES (1, 3);
354
+ INSERT INTO Skills_Required_To_Fix (`part_fault_id`, `skill_id`) VALUES (15, 3);
355
+ INSERT INTO Skills_Required_To_Fix (`part_fault_id`, `skill_id`) VALUES (15, 2);
test_database/bakery_1/bakery_1_michi.txt ADDED
@@ -0,0 +1,411 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Total # = 51
2
+
3
+ 1. What is the most expensive cake and its flavor?
4
+
5
+ select id, flavor
6
+ from goods
7
+ where food = "Cake"
8
+ order by price desc
9
+ limit 1
10
+
11
+ What is the cheapest cookie and its flavor?
12
+
13
+ select id, flavor
14
+ from goods
15
+ where food = "Cookie"
16
+ order by price
17
+ limit 1
18
+
19
+ 2. Find the ids of goods that have apple flavor.
20
+
21
+ Select id
22
+ From goods
23
+ Where flavor = "Apple"
24
+
25
+ What are the ids of goods that cost less than 3 dollars?
26
+
27
+ Select id
28
+ From goods
29
+ Where price < 3
30
+
31
+
32
+ 3. List the distinct ids of all customers who bought a lemon cake?
33
+
34
+ Select DISTINCT T3.CustomerId
35
+ From goods as T1 JOIN items as T2 JOIN receipts as T3 ON T1.Id = T2.Item and T2.Receipt = T3.ReceiptNumber
36
+ Where T1.Flavor = "Lemon" and T1.Food = "Cake"
37
+
38
+
39
+ For each type of food, tell me how many customers have ever bought it.
40
+
41
+ Select T1.food, count(distinct T3.CustomerId)
42
+ From goods as T1 JOIN items as T2 JOIN receipts as T3 ON T1.Id = T2.Item and T2.Receipt = T3.ReceiptNumber
43
+ Group by T1.food
44
+
45
+
46
+ 4. Find the id of customers who shopped at the bakery at least 15 times.
47
+
48
+ Select CustomerId
49
+ From receipts
50
+ Group by CustomerId
51
+ having count(*) >= 15
52
+
53
+ What is the last name of the customers who shopped at the bakery more than 10 times?
54
+
55
+ Select T2.LastName
56
+ From receipts as T1 JOIN customers as T2 ON T1.CustomerId = T2.id
57
+ Group by T2.id
58
+ having count(*) > 10
59
+
60
+
61
+ 5. How many types of Cake does this bakery sell?
62
+
63
+ Select count(*)
64
+ From goods
65
+ where food = "Cake"
66
+
67
+ List all the flavors of Croissant available in this bakery.
68
+
69
+ Select flavor
70
+ From goods
71
+ where food = "Croissant"
72
+
73
+
74
+ 6. Give me a list of all the distinct items bought by the customer number 15.
75
+
76
+ Select distinct T1.item
77
+ from items as T1 JOIN receipts as T2 ON T1.receipt = T2.ReceiptNumber
78
+ Where T2.CustomerId = 15
79
+
80
+
81
+ For each type of food, what are the average, maximum and minimum price?
82
+
83
+ Select food, avg(price), max(price), min(price)
84
+ from goods
85
+ Group by food
86
+
87
+
88
+ 7. Find the receipt numbers where both Cake and Cookie were bought.
89
+
90
+ Select T1.receipt
91
+ From items as T1 JOIN goods as T2 ON T1.item = T2.id
92
+ Where T2.food = "Cake"
93
+ INTERSECT
94
+ Select T1.receipt
95
+ From items as T1 JOIN goods as T2 ON T1.item = T2.id
96
+ Where T2.food = "Cookie"
97
+
98
+
99
+ Find all the receipt numbers in which customer id 5 purchased Croissant.
100
+
101
+ Select ReceiptNumber
102
+ From receipts
103
+ Where CustomerId = 5
104
+ INTERSECT
105
+ Select T1.receipt
106
+ From items as T1 JOIN goods as T2 ON T1.item = T2.id
107
+ Where T2.food = "Croissant"
108
+
109
+
110
+ 8. What is the receipt number and date of the receipt in which the most expensive item was bought?
111
+
112
+ Select T1.ReceiptNumber, T1.Date
113
+ From receipts as T1 JOIN items as T2 JOIN goods as T3 ON T1.ReceiptNumber = T2.receipt and T2.item = T3.id
114
+ Order by T3.price Desc
115
+ LIMIT 1
116
+
117
+
118
+ What is the item that was bought the least number of times?
119
+ Select item
120
+ From items
121
+ Group by item
122
+ Order by count(*)
123
+ LIMIT 1
124
+
125
+
126
+ 9. How many goods are available for each food type?
127
+
128
+ Select count(*), food
129
+ From goods
130
+ group by food
131
+
132
+ What is the average price for each food type?
133
+
134
+ Select avg(price), food
135
+ From goods
136
+ group by food
137
+
138
+
139
+ 10. What are the goods that have Apricot flavor and are cheaper than 5 dollars?
140
+
141
+ Select id
142
+ From goods
143
+ where flavor = "Apricot" and price < 5
144
+
145
+ Find flavor of cakes that cost more than 10 dollars.
146
+
147
+ Select flavor
148
+ From goods
149
+ where food = "Cake" and price > 10
150
+
151
+
152
+ 11. Give me the distinct id and price for all goods whose price is below the average of all goods?
153
+
154
+ Select distinct id, price
155
+ From goods
156
+ where price < (Select avg(price) From goods)
157
+
158
+
159
+ What are the distinct ids of all goods that are cheaper than some goods of type Tart?
160
+
161
+ Select distinct T1.id
162
+ From goods as T1, goods as T2
163
+ where T1.price < T2.price and T2.food = "Tart"
164
+
165
+
166
+ 12. List distinct receipt numbers for which someone bought a good that costs more than 13 dollars.
167
+
168
+ Select distinct T1.ReceiptNumber
169
+ from receipts as T1 JOIN items as T2 JOIN goods as T3 ON T1.ReceiptNumber = T2.receipt and T2.item = T3.id
170
+ Where T3.price > 13
171
+
172
+
173
+ On which date did some customer buy a good that costs more than 15 dollars?
174
+
175
+ Select distinct T1.date
176
+ from receipts as T1 JOIN items as T2 JOIN goods as T3 ON T1.ReceiptNumber = T2.receipt and T2.item = T3.id
177
+ Where T3.price > 15
178
+
179
+
180
+ 13. Give me the list of all goods whose id has "APP".
181
+
182
+ Select id
183
+ from goods
184
+ Where id LIKE "%APP%"
185
+
186
+ Which good has "70" in its id? And what is its price?
187
+
188
+ Select id, price
189
+ from goods
190
+ Where id LIKE "%70%"
191
+
192
+
193
+ 14. List the last names of all customers in an alphabetical oder.
194
+
195
+ Select distinct LastName
196
+ From customers
197
+ Order by LastName
198
+
199
+ Return the ordered list of all good ids.
200
+
201
+ Select distinct id
202
+ From goods
203
+ Order by id
204
+
205
+
206
+ 15. Find all receipts in which either apple flavor pie was bought or customer id 12 shopped.
207
+
208
+ Select T1.receipt
209
+ From items as T1 JOIN goods as T2 ON T1.item = T2.id
210
+ where T2.flavor = "Apple" and T2.food = "Pie"
211
+ UNION
212
+ Select ReceiptNumber
213
+ From receipts
214
+ where CustomerId = 12
215
+
216
+
217
+ Find all receipts which has the latest date. Also tell me that date.
218
+
219
+ Select ReceiptNumber, date
220
+ From receipts
221
+ where date = (Select date From receipts Order by date Desc LIMIT 1)
222
+
223
+
224
+ Find all receipts which either has the earliest date or has a good with price above 10.
225
+
226
+ Select T1.Receipt
227
+ From items as T1 JOIN goods as T2 ON T1.item = T2.id
228
+ where T2.price > 10
229
+ UNION
230
+ Select ReceiptNumber
231
+ From receipts
232
+ where date = (Select date From receipts Order by date LIMIT 1)
233
+
234
+
235
+ 16. What are the ids of Cookie and Cake that cost between 3 and 7 dollars.
236
+
237
+ Select id
238
+ From goods
239
+ where (food = "Cookie" or food = "Cake") and price between 3 and 7
240
+
241
+
242
+ Find the first name and last name of a customer who visited on the earliest date.
243
+
244
+ Select T1.FirstName, T1.LastName
245
+ From customers as T1 JOIN receipts as T2 ON T1.id = T2.CustomerId
246
+ Order by T2.date
247
+ LIMIT 1
248
+
249
+
250
+
251
+ 17. What is average price of goods whose flavor is blackberry or blueberry?
252
+
253
+ Select avg(price)
254
+ From goods
255
+ where flavor = "Blackberry" or flavor = "Blueberry"
256
+
257
+
258
+ Return the cheapest price for goods with cheese flavor.
259
+
260
+ Select min(price)
261
+ From goods
262
+ where flavor = "Cheese"
263
+
264
+
265
+ 18. What are highest, lowest, and average prices of goods, grouped and ordered by flavor?
266
+
267
+ Select max(price), min(price), avg(price), flavor
268
+ From goods
269
+ group by flavor
270
+ order by flavor
271
+
272
+
273
+ Return the lowest and highest prices of goods grouped and ordered by food type.
274
+
275
+ Select min(price), max(price), food
276
+ From goods
277
+ group by food
278
+ order by food
279
+
280
+
281
+ 19. Find the top three dates when the most goods were sold.
282
+
283
+ Select date
284
+ From receipts
285
+ Group by date
286
+ Order by count(*)
287
+ LIMIT 3
288
+
289
+ Which customer shopped most often? How many times?
290
+
291
+ Select CustomerId, count(*)
292
+ From receipts
293
+ Group by CustomerId
294
+ Order by count(*)
295
+ LIMIT 1
296
+
297
+
298
+ 20. For each date, return how many distinct customers visited on that day.
299
+
300
+ Select date, count (distinct CustomerId)
301
+ from receipts
302
+ Group by date
303
+
304
+
305
+ Give me the first name and last name of customers who have bought apple flavor Tart.
306
+
307
+ Select distinct T4.FirstName, T4.LastName
308
+ from goods as T1 JOIN items as T2 JOIN receipts as T3 JOIN customers as T4 ON T1.id = T2.item and T2.receipt = T3.ReceiptNumber and T3.CustomerId = T4.id
309
+ where T1.flavor = "Apple" and T1.food = "Tart"
310
+
311
+
312
+ 21. What are the ids of Cookies whose price is lower than any Croissant?
313
+
314
+ Select id
315
+ From goods
316
+ where food = "Cookie" and price < (select min(price)
317
+ from goods
318
+ where food = 'Croissant')
319
+
320
+
321
+ Give me the ids of Cakes whose price is at least three times as much as the average price of Tart?
322
+
323
+ Select id
324
+ From goods
325
+ where food = "Cake" and price >= 3 * (select avg(price)
326
+ from goods
327
+ where food = "Tart")
328
+
329
+
330
+ What are the ids of goods whose price is above twice the average price of all goods?
331
+
332
+ Select id
333
+ From goods
334
+ where price > 2 * (select avg(price)
335
+ from goods)
336
+
337
+
338
+ 22. List the id, flavor and type of food of goods ordered by price.
339
+
340
+ Select id, flavor, food
341
+ From goods
342
+ order by price
343
+
344
+
345
+ Return a list of the id and flavor for Cakes ordered by flavor.
346
+
347
+ Select id, flavor
348
+ From goods
349
+ where food = "Cake"
350
+ order by flavor
351
+
352
+
353
+
354
+ 23. Find all the items that have chocolate flavor but were not bought more than 10 times.
355
+
356
+ Select distinct T1.item
357
+ From items as T1 JOIN goods as T2 ON T1.item = T2.id
358
+ Where T2.flavor = "Chocolate"
359
+ EXCEPT
360
+ Select distinct item
361
+ From items
362
+ Group by item
363
+ having count(*) > 10
364
+
365
+
366
+ What are the flavors available for Cake but not for Tart?
367
+
368
+ Select distinct flavor
369
+ From goods
370
+ where food = "Cake"
371
+ EXCEPT
372
+ Select distinct flavor
373
+ From goods
374
+ where food = "Tart"
375
+
376
+
377
+ 24. What is the three most popular goods in this bakery?
378
+
379
+ Select item
380
+ From items
381
+ Group by item
382
+ Order by count (*) DESC
383
+ LIMIT 3
384
+
385
+
386
+
387
+ 25. Find the ids of customers who have spent more than 150 dollars in total.
388
+
389
+ Select T3.CustomerId
390
+ From goods as T1 JOIN items as T2 JOIN receipts as T3 ON T1.id = T2.item and T2.receipt = T3.ReceiptNumber
391
+ Group by T3.CustomerId
392
+ having sum(T1.price) > 150
393
+
394
+
395
+ Find the ids of customers whose average spending for each good is above 5.
396
+
397
+ Select T3.CustomerId
398
+ From goods as T1 JOIN items as T2 JOIN receipts as T3 ON T1.id = T2.item and T2.receipt = T3.ReceiptNumber
399
+ Group by T3.CustomerId
400
+ having avg(T1.price) > 5
401
+
402
+
403
+
404
+ On which day did the bakery sell more than 100 dollars in total.
405
+
406
+ Select T3.date
407
+ From goods as T1 JOIN items as T2 JOIN receipts as T3 ON T1.id = T2.item and T2.receipt = T3.ReceiptNumber
408
+ Group by T3.date
409
+ having sum(T1.price) > 100
410
+
411
+
test_database/baseball_1/baseball_1.sqlite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cbeb49298ffc84465f7a27f3477fe73e05a2ced8d4c3c972d20d75c25820f29b
3
+ size 29794304
test_database/baseball_1/schema.sql ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f2e61f0638e45f4d9f869c377b56f99f988d58f2a64999637c93691ebf2eb3a2
3
+ size 57608249
test_database/bike_racing/bike_racing.sqlite ADDED
Binary file (28.7 kB). View file
 
test_database/bike_racing/schema_old.sql ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PRAGMA foreign_keys=ON;
2
+ BEGIN TRANSACTION;
3
+ CREATE TABLE IF NOT EXISTS "bike" (
4
+ "id" int,
5
+ "product_name" text,
6
+ "weight" int,
7
+ "price" real,
8
+ "material" text,
9
+ primary key("id")
10
+ );
11
+ INSERT INTO bike VALUES(1,'BIANCHI SPECIALISSIMA',780,9998.9999999999999999,'Carbon CC');
12
+ INSERT INTO bike VALUES(2,'CANNONDALE SUPERSIX EVO HI-MOD DURA ACE',850,5329.9999999999999999,'carbon fiber');
13
+ INSERT INTO bike VALUES(3,'CANYON AEROAD CF SLX 8.0 DI2',880,3049.9999999999999999,'Toray T700 and T800 carbon fiber');
14
+ INSERT INTO bike VALUES(4,'GIANT TCR ADVANCED SL 0',750,9000.0,'Carbon CC');
15
+ INSERT INTO bike VALUES(5,'Ibis',800,3598.9999999999999998,'Carbon CC');
16
+ INSERT INTO bike VALUES(6,'Ibis ||',760,5000, 'carbon fiber');
17
+ CREATE TABLE IF NOT EXISTS "cyclist" (
18
+ "id" int,
19
+ "heat" int,
20
+ "name" text,
21
+ "nation" text,
22
+ "result" real,
23
+ primary key("id")
24
+ );
25
+ INSERT INTO cyclist VALUES(1,4,'Bradley Wiggins','Great Britain','4:16.571');
26
+ INSERT INTO cyclist VALUES(2,3,'Hayden Roulston','New Zealand','4:19.232');
27
+ INSERT INTO cyclist VALUES(3,1,'Steven Burke','Great Britain','4:21.558');
28
+ INSERT INTO cyclist VALUES(4,2,'Alexei Markov','Russia','4:22.308');
29
+ INSERT INTO cyclist VALUES(5,1,'Volodymyr Dyudya','Ukraine','4:22.471');
30
+ INSERT INTO cyclist VALUES(6,2,'Antonio Tauler','Spain','4:24.974');
31
+ INSERT INTO cyclist VALUES(7,4,'Alexander Serov','Russia','4:25.391');
32
+ INSERT INTO cyclist VALUES(8,3,'Taylor Phinney','United States','4:26.644');
33
+ CREATE TABLE IF NOT EXISTS "cyclists_own_bikes" (
34
+ "cyclist_id" int,
35
+ "bike_id" int,
36
+ "purchase_year" int,
37
+ primary key("cyclist_id", "bike_id"),
38
+ foreign key("cyclist_id") references "cyclist"("id"),
39
+ foreign key("bike_id") references "bike"("id")
40
+ );
41
+ INSERT INTO cyclists_own_bikes VALUES(1,2,2011);
42
+ INSERT INTO cyclists_own_bikes VALUES(1,3,2015);
43
+ INSERT INTO cyclists_own_bikes VALUES(2,3,2017);
44
+ INSERT INTO cyclists_own_bikes VALUES(2,5,2013);
45
+ INSERT INTO cyclists_own_bikes VALUES(2,4,2018);
46
+ INSERT INTO cyclists_own_bikes VALUES(3,4,2017);
47
+ INSERT INTO cyclists_own_bikes VALUES(4,4,2017);
48
+ INSERT INTO cyclists_own_bikes VALUES(5,5,2016);
49
+ INSERT INTO cyclists_own_bikes VALUES(6,5,2016);
50
+ INSERT INTO cyclists_own_bikes VALUES(7,5,2010);
51
+ INSERT INTO cyclists_own_bikes VALUES(7,4,2011);
52
+ INSERT INTO cyclists_own_bikes VALUES(7,2,2012);
53
+ INSERT INTO cyclists_own_bikes VALUES(7,1,2013);
54
+ INSERT INTO cyclists_own_bikes VALUES(7,3,2014);
55
+ COMMIT;
56
+
test_database/body_builder/body_builder.sqlite ADDED
Binary file (20.5 kB). View file
 
test_database/body_builder/schema.sql ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PRAGMA foreign_keys = ON;
2
+
3
+ CREATE TABLE "body_builder" (
4
+ "Body_Builder_ID" int,
5
+ "People_ID" int,
6
+ "Snatch" real,
7
+ "Clean_Jerk" real,
8
+ "Total" real,
9
+ PRIMARY KEY ("Body_Builder_ID"),
10
+ FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
11
+ );
12
+
13
+ CREATE TABLE "people" (
14
+ "People_ID" int,
15
+ "Name" text,
16
+ "Height" real,
17
+ "Weight" real,
18
+ "Birth_Date" text,
19
+ "Birth_Place" text,
20
+ PRIMARY KEY ("People_ID")
21
+ );
22
+
23
+ INSERT INTO "people" VALUES (1,"Jack Campbell","182","80","January 1, 1992","Port Huron, Michigan");
24
+ INSERT INTO "people" VALUES (2,"Ty Conklin","192","90","March 30, 1976","Anchorage, Alaska");
25
+ INSERT INTO "people" VALUES (3,"Al Montoya","195","100","February 13, 1985","Glenview, Illinois");
26
+ INSERT INTO "people" VALUES (4,"Mark Fayne","215","102","May 5, 1987","Nashua, New Hampshire");
27
+ INSERT INTO "people" VALUES (5,"Cam Fowler","196","89","December 5, 1991","Farmington Hills, Michigan");
28
+ INSERT INTO "people" VALUES (6,"Jake Gardiner","205","92","July 4, 1990","Minnetonka, Minnesota");
29
+
30
+
31
+ INSERT INTO "body_builder" VALUES (1,1,"142.5","175.0","317.5");
32
+ INSERT INTO "body_builder" VALUES (2,2,"137.5","177.5","315.0");
33
+ INSERT INTO "body_builder" VALUES (3,3,"140.0","175.0","315.0");
34
+ INSERT INTO "body_builder" VALUES (4,5,"137.5","175.0","312.5");
35
+ INSERT INTO "body_builder" VALUES (5,6,"130.0","162.5","292.5");
36
+
37
+
test_database/chinook_1/chinook_1.sqlite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:70b3eb8c3ffb5351eb7943e3bf05b693a5397c22d200ff022ef99e2ca18ab7b9
3
+ size 901120
test_database/city_record/schema.sql ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PRAGMA foreign_keys = ON;
2
+
3
+
4
+ CREATE TABLE "city" (
5
+ "City_ID" int,
6
+ "City" text,
7
+ "Hanzi" text,
8
+ "Hanyu_Pinyin" text,
9
+ "Regional_Population" int,
10
+ "GDP" real,
11
+ PRIMARY KEY ("City_ID")
12
+ );
13
+
14
+ CREATE TABLE "match" (
15
+ "Match_ID" int,
16
+ "Date" text,
17
+ "Venue" text,
18
+ "Score" text,
19
+ "Result" text,
20
+ "Competition" text,
21
+ PRIMARY KEY ("Match_ID")
22
+ );
23
+
24
+
25
+
26
+ CREATE TABLE "temperature" (
27
+ "City_ID" int,
28
+ "Jan" real,
29
+ "Feb" real,
30
+ "Mar" real,
31
+ "Apr" real,
32
+ "Jun" real,
33
+ "Jul" real,
34
+ "Aug" real,
35
+ "Sep" real,
36
+ "Oct" real,
37
+ "Nov" real,
38
+ "Dec" real,
39
+ PRIMARY KEY ("City_ID"),
40
+ FOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)
41
+ );
42
+
43
+ INSERT INTO "city" VALUES (1,"Shanghai","上海","Shànghǎi","23019148","1919.57");
44
+ INSERT INTO "city" VALUES (2,"Nanjing ( Jiangsu )","南京","Nánjīng","8004680","614.55");
45
+ INSERT INTO "city" VALUES (3,"Hangzhou ( Zhejiang )","杭州","Hángzhōu","8700400","701.18");
46
+ INSERT INTO "city" VALUES (4,"Suzhou ( Jiangsu )","苏州/ 蘇州","Sūzhōu","10465994","1071.70");
47
+ INSERT INTO "city" VALUES (5,"Ningbo ( Zhejiang )","宁波/ 寧波","Níngbō","7605689","601.05");
48
+ INSERT INTO "city" VALUES (6,"Wuxi ( Jiangsu )","无锡/ 無錫","Wúxī","6372624","688.02");
49
+ INSERT INTO "city" VALUES (7,"Nantong ( Jiangsu )","南通","Nántōng","7282835","408.02");
50
+ INSERT INTO "city" VALUES (8,"Shaoxing ( Zhejiang )","绍兴/ 紹興","Shàoxīng","4912200","329.12");
51
+ INSERT INTO "city" VALUES (9,"Changzhou ( Jiangsu )","常州","Chángzhōu","4591972","358.04");
52
+ INSERT INTO "city" VALUES (10,"Jinhua ( Zhejiang )","金华/ 金華","Jīnhuá","4614100","244.77");
53
+ INSERT INTO "city" VALUES (11,"Jiaxing ( Zhejiang )","嘉兴/ 嘉興","Jiāxīng","4501700","266.81");
54
+ INSERT INTO "city" VALUES (12,"Taizhou ( Zhejiang )","台州","Tāizhōu","5968800","279.49");
55
+ INSERT INTO "city" VALUES (13,"Yangzhou ( Jiangsu )","扬州/ 揚州","Yángzhōu","4459760","263.03");
56
+
57
+ INSERT INTO "temperature" VALUES (1,17.8,17.8,18.3,18.9,20.0,20.6,20.6,20.6,20.0,19.4,18.3);
58
+ INSERT INTO "temperature" VALUES (2,26.1,26.1,26.1,26.1,27.8,27.8,28.3,28.3,28.3,27.2,26.7);
59
+ INSERT INTO "temperature" VALUES (3,18.9,18.3,19.4,20.0,22.2,23.3,23.9,23.3,22.8,21.7,20.0);
60
+ INSERT INTO "temperature" VALUES (4,26.7,27.2,27.8,28.3,30.6,31.1,31.7,31.7,30.6,28.9,27.8);
61
+ INSERT INTO "temperature" VALUES (6,17.2,17.2,18.3,18.9,20.6,21.7,21.7,21.1,20.6,20.0,18.3);
62
+ INSERT INTO "temperature" VALUES (10,26.7,27.2,27.8,27.8,30.0,30.6,31.1,31.1,30.6,28.9,27.8);
63
+ INSERT INTO "temperature" VALUES (7,18.3,18.9,19.4,20.6,22.8,23.3,23.3,23.3,22.8,21.7,20.0);
64
+ INSERT INTO "temperature" VALUES (11,25.6,26.6,26.6,26.1,28.3,28.9,29.4,29.4,28.9,27.2,26.1);
65
+
66
+ INSERT INTO "match" VALUES (1,"18 February 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","2-0","Friendly match");
67
+ INSERT INTO "match" VALUES (2,"19 July 1992","Estadio Rigoberto López , Managua , Nicaragua","3-0","5-0","1994 FIFA World Cup qualification");
68
+ INSERT INTO "match" VALUES (3,"23 July 1992","Estadio Cuscatlán , San Salvador , El Salvador","1-0","5-1","1994 FIFA World Cup qualification");
69
+ INSERT INTO "match" VALUES (4,"23 July 1992","Estadio Cuscatlán , San Salvador , El Salvador","3-0","5-1","1994 FIFA World Cup qualification");
70
+ INSERT INTO "match" VALUES (5,"4 April 1993","Estadio Cuscatlán , San Salvador , El Salvador","1–0","2–1","1994 FIFA World Cup qualification");
71
+ INSERT INTO "match" VALUES (6,"23 July 2000","Estadio Cuscatlán , San Salvador , El Salvador","2–1","7–1","2002 FIFA World Cup qualification");
72
+
73
+
74
+ CREATE TABLE "hosting_city" (
75
+ "Year" int,
76
+ "Match_ID" int,
77
+ "Host_City" text,
78
+ PRIMARY KEY ("Year"),
79
+ FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),
80
+ FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)
81
+ );
82
+
83
+ INSERT INTO "hosting_city" VALUES ("2008",1,1);
84
+ INSERT INTO "hosting_city" VALUES ("2009",2,2);
85
+ INSERT INTO "hosting_city" VALUES ("2010",3,2);
86
+ INSERT INTO "hosting_city" VALUES ("2011",4,6);
87
+ INSERT INTO "hosting_city" VALUES ("2012",5,12);
88
+ INSERT INTO "hosting_city" VALUES ("2013",6,11);
test_database/coffee_shop/coffee_shop.sqlite ADDED
Binary file (36.9 kB). View file
 
test_database/company_1/company_1.sqlite ADDED
Binary file (12.3 kB). View file
 
test_database/company_1/link.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ https://www.classes.cs.uchicago.edu/archive/2009/spring/23500-1/homework.html
test_database/concert_singer/concert_singer.sqlite ADDED
Binary file (36.9 kB). View file
 
test_database/concert_singer/schema.sql ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PRAGMA foreign_keys = ON;
2
+
3
+
4
+ CREATE TABLE "stadium" (
5
+ "Stadium_ID" int,
6
+ "Location" text,
7
+ "Name" text,
8
+ "Capacity" int,
9
+ "Highest" int,
10
+ "Lowest" int,
11
+ "Average" int,
12
+ PRIMARY KEY ("Stadium_ID")
13
+ );
14
+
15
+
16
+ INSERT INTO "stadium" VALUES (1,"Raith Rovers","Stark's Park","10104","4812","1294","2106");
17
+ INSERT INTO "stadium" VALUES (2,"Ayr United","Somerset Park","11998","2363","1057","1477");
18
+ INSERT INTO "stadium" VALUES (3,"East Fife","Bayview Stadium","2000","1980","533","864");
19
+ INSERT INTO "stadium" VALUES (4,"Queen's Park","Hampden Park","52500","1763","466","730");
20
+ INSERT INTO "stadium" VALUES (5,"Stirling Albion","Forthbank Stadium","3808","1125","404","642");
21
+ INSERT INTO "stadium" VALUES (6,"Arbroath","Gayfield Park","4125","921","411","638");
22
+ INSERT INTO "stadium" VALUES (7,"Alloa Athletic","Recreation Park","3100","1057","331","637");
23
+ INSERT INTO "stadium" VALUES (9,"Peterhead","Balmoor","4000","837","400","615");
24
+ INSERT INTO "stadium" VALUES (10,"Brechin City","Glebe Park","3960","780","315","552");
25
+
26
+ CREATE TABLE "singer" (
27
+ "Singer_ID" int,
28
+ "Name" text,
29
+ "Country" text,
30
+ "Song_Name" text,
31
+ "Song_release_year" text,
32
+ "Age" int,
33
+ "Is_male" bool,
34
+ PRIMARY KEY ("Singer_ID")
35
+ );
36
+
37
+
38
+
39
+ INSERT INTO "singer" VALUES (1,"Joe Sharp","Netherlands","You","1992",52,"F");
40
+ INSERT INTO "singer" VALUES (2,"Timbaland","United States","Dangerous","2008",32,"T");
41
+ INSERT INTO "singer" VALUES (3,"Justin Brown","France","Hey Oh","2013",29,"T");
42
+ INSERT INTO "singer" VALUES (4,"Rose White","France","Sun","2003",41,"F");
43
+ INSERT INTO "singer" VALUES (5,"John Nizinik","France","Gentleman","2014",43,"T");
44
+ INSERT INTO "singer" VALUES (6,"Tribal King","France","Love","2016",25,"T");
45
+
46
+
47
+ CREATE TABLE "concert" (
48
+ "concert_ID" int,
49
+ "concert_Name" text,
50
+ "Theme" text,
51
+ "Stadium_ID" text,
52
+ "Year" text,
53
+ PRIMARY KEY ("concert_ID"),
54
+ FOREIGN KEY ("Stadium_ID") REFERENCES "stadium"("Stadium_ID")
55
+ );
56
+
57
+
58
+
59
+ INSERT INTO "concert" VALUES (1,"Auditions","Free choice",1,2014);
60
+ INSERT INTO "concert" VALUES (2,"Super bootcamp","Free choice 2",2,2014);
61
+ INSERT INTO "concert" VALUES (3,"Home Visits","Bleeding Love",2,2015);
62
+ INSERT INTO "concert" VALUES (4,"Week 1","Wide Awake",10,2014);
63
+ INSERT INTO "concert" VALUES (5,"Week 1","Happy Tonight",9,2015);
64
+ INSERT INTO "concert" VALUES (6,"Week 2","Party All Night",7,2015);
65
+
66
+
67
+ CREATE TABLE "singer_in_concert" (
68
+ "concert_ID" int,
69
+ "Singer_ID" text,
70
+ PRIMARY KEY ("concert_ID","Singer_ID"),
71
+ FOREIGN KEY ("concert_ID") REFERENCES "concert"("concert_ID"),
72
+ FOREIGN KEY ("Singer_ID") REFERENCES "singer"("Singer_ID")
73
+ );
74
+
75
+ INSERT INTO "singer_in_concert" VALUES (1, 2);
76
+ INSERT INTO "singer_in_concert" VALUES (1, 3);
77
+ INSERT INTO "singer_in_concert" VALUES (1, 5);
78
+ INSERT INTO "singer_in_concert" VALUES (2, 3);
79
+ INSERT INTO "singer_in_concert" VALUES (2, 6);
80
+ INSERT INTO "singer_in_concert" VALUES (3, 5);
81
+ INSERT INTO "singer_in_concert" VALUES (4, 4);
82
+ INSERT INTO "singer_in_concert" VALUES (5, 6);
83
+ INSERT INTO "singer_in_concert" VALUES (5, 3);
84
+ INSERT INTO "singer_in_concert" VALUES (6, 2);
85
+
test_database/county_public_safety/county_public_safety.sqlite ADDED
Binary file (20.5 kB). View file
 
test_database/county_public_safety/schema.sql ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PRAGMA foreign_keys = ON;
2
+
3
+ CREATE TABLE "county_public_safety" (
4
+ "County_ID" int,
5
+ "Name" text,
6
+ "Population" int,
7
+ "Police_officers" int,
8
+ "Residents_per_officer" int,
9
+ "Case_burden" int,
10
+ "Crime_rate" real,
11
+ "Police_force" text,
12
+ "Location" text,
13
+ PRIMARY KEY ("County_ID")
14
+ );
15
+
16
+ CREATE TABLE "city" (
17
+ "City_ID" int,
18
+ "County_ID" int,
19
+ "Name" text,
20
+ "White" real,
21
+ "Black" real,
22
+ "Amerindian" real,
23
+ "Asian" real,
24
+ "Multiracial" real,
25
+ "Hispanic" real,
26
+ PRIMARY KEY ("City_ID"),
27
+ FOREIGN KEY ("County_ID") REFERENCES "county_public_safety"("County_ID")
28
+ );
29
+
30
+ INSERT INTO "county_public_safety" VALUES (1,"Abbotsford","128165","187","685","81","118","Abbotsford Police Department","East");
31
+ INSERT INTO "county_public_safety" VALUES (2,"Burnaby","204320","253","808","100","123","RCMP","East");
32
+ INSERT INTO "county_public_safety" VALUES (3,"Campbell River","30810","40","770","137","178","RCMP","West");
33
+ INSERT INTO "county_public_safety" VALUES (4,"Castlegar","7821","11","711","107","150","RCMP","North");
34
+ INSERT INTO "county_public_safety" VALUES (5,"Central Saanich","16821","21","801","39","49","Central Saanich Police","East");
35
+ INSERT INTO "county_public_safety" VALUES (6,"Chilliwack","73066","91","803","140","174","RCMP","West");
36
+
37
+
38
+
39
+ INSERT INTO "city" VALUES (1,1,"Adjuntas","93.1","3.1","0.3","0.0","3.4","99.6");
40
+ INSERT INTO "city" VALUES (2,1,"Aguada","86.6","5.3","0.3","0.1","7.7","99.4");
41
+ INSERT INTO "city" VALUES (3,1,"Aguadilla","83.0","7.4","0.3","0.2","8.2","98.5");
42
+ INSERT INTO "city" VALUES (4,2,"Aguas Buenas","72.5","12.6","0.6","0.1","14.2","99.5");
43
+ INSERT INTO "city" VALUES (5,2,"Aibonito","83.5","7.3","0.2","0.0","9.0","99.3");
44
+ INSERT INTO "city" VALUES (6,3,"Añasco","82.0","7.2","0.4","0.1","10.3","99.2");
45
+ INSERT INTO "city" VALUES (7,3,"Arecibo","84.5","6.1","0.4","0.1","7.9","99.2");
46
+ INSERT INTO "city" VALUES (8,3,"Arroyo","53.5","32.5","0.9","0.2","13.0","99.1");
47
+ INSERT INTO "city" VALUES (9,3,"Barceloneta","80.7","7.6","0.3","0.1","11.2","99.4");
48
+ INSERT INTO "city" VALUES (10,3,"Barranquitas","86.0","5.4","0.3","0.0","8.3","99.3");
49
+ INSERT INTO "city" VALUES (11,3,"Bayamón","78.3","10.3","0.6","0.2","10.7","99.0");
50
+ INSERT INTO "city" VALUES (12,4,"Cabo Rojo","84.1","5.4","0.3","0.1","10.1","98.9");
51
+ INSERT INTO "city" VALUES (13,4,"Caguas","76.1","11.0","0.6","0.2","12.1","99.1");
52
+ INSERT INTO "city" VALUES (14,5,"Camuy","87.9","4.1","0.3","0.1","7.6","99.4");
53
+ INSERT INTO "city" VALUES (15,5,"Canóvanas","61.2","21.6","0.9","0.2","16.1","99.2");
54
+ INSERT INTO "city" VALUES (16,6,"Carolina","64.3","22.8","0.9","0.4","11.7","98.6");
55
+ INSERT INTO "city" VALUES (17,6,"Cataño","70.7","14.4","1.0","0.3","13.7","99.0");
56
+
test_database/cre_Docs_and_Epenses/schema.sql ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PRAGMA foreign_keys = ON;
2
+
3
+ CREATE TABLE Ref_Document_Types (
4
+ Document_Type_Code CHAR(15) NOT NULL,
5
+ Document_Type_Name VARCHAR(255) NOT NULL,
6
+ Document_Type_Description VARCHAR(255) NOT NULL,
7
+ PRIMARY KEY (Document_Type_Code)
8
+ );
9
+ CREATE TABLE Ref_Budget_Codes (
10
+ Budget_Type_Code CHAR(15) NOT NULL,
11
+ Budget_Type_Description VARCHAR(255) NOT NULL,
12
+ PRIMARY KEY (Budget_Type_Code)
13
+ );
14
+ INSERT INTO Ref_Budget_Codes (`Budget_Type_Code`, `Budget_Type_Description`) VALUES ('GV', 'Government');
15
+ INSERT INTO Ref_Budget_Codes (`Budget_Type_Code`, `Budget_Type_Description`) VALUES ('ORG', 'Organisation');
16
+ INSERT INTO Ref_Budget_Codes (`Budget_Type_Code`, `Budget_Type_Description`) VALUES ('SF', 'Self founded');
17
+ INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('BK', 'Book', 'excellent');
18
+ INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', 'excellent');
19
+ INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('PT', 'Presentation', 'very good');
20
+ INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('PP', 'Paper', 'good');
21
+ INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('FM', 'Film', 'fun');
22
+
23
+
24
+ CREATE TABLE Projects (
25
+ Project_ID INTEGER NOT NULL,
26
+ Project_Details VARCHAR(255),
27
+ PRIMARY KEY (Project_ID)
28
+ );
29
+ INSERT INTO Projects (`Project_ID`, `Project_Details`) VALUES (30, 'Society Research project');
30
+ INSERT INTO Projects (`Project_ID`, `Project_Details`) VALUES (35, 'Internet of Things project');
31
+ INSERT INTO Projects (`Project_ID`, `Project_Details`) VALUES (105, 'Graph Database project');
32
+ INSERT INTO Projects (`Project_ID`, `Project_Details`) VALUES (134, 'Human Resource project');
33
+ INSERT INTO Projects (`Project_ID`, `Project_Details`) VALUES (195, 'Population Research project');
34
+
35
+
36
+ CREATE TABLE Documents (
37
+ Document_ID INTEGER NOT NULL,
38
+ Document_Type_Code CHAR(15) NOT NULL,
39
+ Project_ID INTEGER NOT NULL,
40
+ Document_Date DATETIME,
41
+ Document_Name VARCHAR(255),
42
+ Document_Description VARCHAR(255),
43
+ Other_Details VARCHAR(255),
44
+ PRIMARY KEY (Document_ID),
45
+ FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
46
+ FOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)
47
+ );
48
+ INSERT INTO Documents (`Document_ID`, `Document_Type_Code`, `Project_ID`, `Document_Date`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (29, 'CV', 30, '2004-08-28 06:59:19', 'Review on UK files', NULL, NULL);
49
+ INSERT INTO Documents (`Document_ID`, `Document_Type_Code`, `Project_ID`, `Document_Date`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (42, 'BK', 105, '2012-12-27 19:09:18', 'Review on Canadian files', NULL, NULL);
50
+ INSERT INTO Documents (`Document_ID`, `Document_Type_Code`, `Project_ID`, `Document_Date`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (57, 'CV', 195, '1980-10-22 14:17:11', 'Review on French files', NULL, NULL);
51
+ INSERT INTO Documents (`Document_ID`, `Document_Type_Code`, `Project_ID`, `Document_Date`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (121, 'BK', 105, '1981-11-29 10:23:01', 'Review on USA files', NULL, NULL);
52
+ INSERT INTO Documents (`Document_ID`, `Document_Type_Code`, `Project_ID`, `Document_Date`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (181, 'PP', 105, '1970-06-17 14:03:21', 'Chapter on private files', NULL, NULL);
53
+ INSERT INTO Documents (`Document_ID`, `Document_Type_Code`, `Project_ID`, `Document_Date`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (192, 'PP', 134, '2013-01-26 15:15:25', 'Book on USA files', NULL, NULL);
54
+ INSERT INTO Documents (`Document_ID`, `Document_Type_Code`, `Project_ID`, `Document_Date`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (226, 'BK', 30, '1991-07-08 08:49:59', 'Review on UK files', NULL, NULL);
55
+ INSERT INTO Documents (`Document_ID`, `Document_Type_Code`, `Project_ID`, `Document_Date`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (227, 'BK', 30, '1970-03-06 07:34:49', 'Deontae files', NULL, NULL);
56
+ INSERT INTO Documents (`Document_ID`, `Document_Type_Code`, `Project_ID`, `Document_Date`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (240, 'BK', 105, '1971-06-09 19:03:41', 'Winona Book', NULL, NULL);
57
+ INSERT INTO Documents (`Document_ID`, `Document_Type_Code`, `Project_ID`, `Document_Date`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (300, 'FM', 35, '2007-09-26 02:39:11', 'Trenton Presentation', NULL, NULL);
58
+ INSERT INTO Documents (`Document_ID`, `Document_Type_Code`, `Project_ID`, `Document_Date`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (309, 'BK', 35, '1978-10-15 10:33:17', 'Noel CV', NULL, NULL);
59
+ INSERT INTO Documents (`Document_ID`, `Document_Type_Code`, `Project_ID`, `Document_Date`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (318, 'PP', 134, '1970-01-30 10:53:35', 'King Book', NULL, NULL);
60
+ INSERT INTO Documents (`Document_ID`, `Document_Type_Code`, `Project_ID`, `Document_Date`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (367, 'CV', 134, '1983-08-24 17:10:26', 'Jevon Paper', NULL, NULL);
61
+ INSERT INTO Documents (`Document_ID`, `Document_Type_Code`, `Project_ID`, `Document_Date`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (371, 'PP', 105, '1976-05-06 12:56:12', 'Katheryn statement', NULL, NULL);
62
+ INSERT INTO Documents (`Document_ID`, `Document_Type_Code`, `Project_ID`, `Document_Date`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (383, 'PP', 35, '2005-10-28 03:17:16', 'Review on UK files', NULL, NULL);
63
+
64
+
65
+ CREATE TABLE Statements (
66
+ Statement_ID INTEGER NOT NULL,
67
+ Statement_Details VARCHAR(255),
68
+ PRIMARY KEY (Statement_ID),
69
+ FOREIGN KEY (Statement_ID) REFERENCES Documents (Document_ID)
70
+ );
71
+ INSERT INTO Statements (`Statement_ID`, `Statement_Details`) VALUES (57, 'Open Project');
72
+ INSERT INTO Statements (`Statement_ID`, `Statement_Details`) VALUES (192, 'Private Project');
73
+
74
+
75
+
76
+ CREATE TABLE Documents_with_Expenses (
77
+ Document_ID INTEGER NOT NULL,
78
+ Budget_Type_Code CHAR(15) NOT NULL,
79
+ Document_Details VARCHAR(255),
80
+ PRIMARY KEY (Document_ID),
81
+ FOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),
82
+ FOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)
83
+ );
84
+ INSERT INTO Documents_with_Expenses (`Document_ID`, `Budget_Type_Code`, `Document_Details`) VALUES (57, 'GV', 'government');
85
+ INSERT INTO Documents_with_Expenses (`Document_ID`, `Budget_Type_Code`, `Document_Details`) VALUES (192, 'GV', 'government');
86
+ INSERT INTO Documents_with_Expenses (`Document_ID`, `Budget_Type_Code`, `Document_Details`) VALUES (226, 'GV', 'government');
87
+ INSERT INTO Documents_with_Expenses (`Document_ID`, `Budget_Type_Code`, `Document_Details`) VALUES (227, 'GV', 'government');
88
+ INSERT INTO Documents_with_Expenses (`Document_ID`, `Budget_Type_Code`, `Document_Details`) VALUES (240, 'GV', 'government');
89
+ INSERT INTO Documents_with_Expenses (`Document_ID`, `Budget_Type_Code`, `Document_Details`) VALUES (300, 'GV', 'government');
90
+ INSERT INTO Documents_with_Expenses (`Document_ID`, `Budget_Type_Code`, `Document_Details`) VALUES (309, 'SF', 'safety');
91
+ INSERT INTO Documents_with_Expenses (`Document_ID`, `Budget_Type_Code`, `Document_Details`) VALUES (367, 'SF', 'safety');
92
+ INSERT INTO Documents_with_Expenses (`Document_ID`, `Budget_Type_Code`, `Document_Details`) VALUES (371, 'ORG', 'organization');
93
+ INSERT INTO Documents_with_Expenses (`Document_ID`, `Budget_Type_Code`, `Document_Details`) VALUES (383, 'ORG', 'organization');
94
+
95
+
96
+ CREATE TABLE Accounts (
97
+ Account_ID INTEGER NOT NULL,
98
+ Statement_ID INTEGER NOT NULL,
99
+ Account_Details VARCHAR(255),
100
+ PRIMARY KEY (Account_ID),
101
+ FOREIGN KEY (Statement_ID) REFERENCES Statements (Statement_ID)
102
+ );
103
+ INSERT INTO Accounts (`Account_ID`, `Statement_ID`, `Account_Details`) VALUES (7, 57, '495.063');
104
+ INSERT INTO Accounts (`Account_ID`, `Statement_ID`, `Account_Details`) VALUES (61, 57, '930.14');
105
+ INSERT INTO Accounts (`Account_ID`, `Statement_ID`, `Account_Details`) VALUES (98, 57, '6035.84');
106
+ INSERT INTO Accounts (`Account_ID`, `Statement_ID`, `Account_Details`) VALUES (136, 57, '199.52');
107
+ INSERT INTO Accounts (`Account_ID`, `Statement_ID`, `Account_Details`) VALUES (164, 192, '12223.93');
108
+ INSERT INTO Accounts (`Account_ID`, `Statement_ID`, `Account_Details`) VALUES (209, 57, '11130.23');
109
+ INSERT INTO Accounts (`Account_ID`, `Statement_ID`, `Account_Details`) VALUES (211, 192, '1230.454');
110
+ INSERT INTO Accounts (`Account_ID`, `Statement_ID`, `Account_Details`) VALUES (240, 192, '6352.31');
111
+ INSERT INTO Accounts (`Account_ID`, `Statement_ID`, `Account_Details`) VALUES (262, 57, '147.96');
112
+ INSERT INTO Accounts (`Account_ID`, `Statement_ID`, `Account_Details`) VALUES (280, 57, '187.14');
113
+ INSERT INTO Accounts (`Account_ID`, `Statement_ID`, `Account_Details`) VALUES (321, 192, '745.817');
114
+ INSERT INTO Accounts (`Account_ID`, `Statement_ID`, `Account_Details`) VALUES (346, 192, '127.9');
115
+ INSERT INTO Accounts (`Account_ID`, `Statement_ID`, `Account_Details`) VALUES (414, 57, '25.41');
116
+ INSERT INTO Accounts (`Account_ID`, `Statement_ID`, `Account_Details`) VALUES (427, 57, '1168.32');
117
+ INSERT INTO Accounts (`Account_ID`, `Statement_ID`, `Account_Details`) VALUES (451, 192, '658.26');
test_database/cre_Drama_Workshop_Groups/cre_Drama_Workshop_Groups.sqlite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a9a9e215fae2314be429307b47ee7fc3ffdc749fba933faba980b97a5f6b9a0a
3
+ size 147456
test_database/customer_complaints/customer_complaints.sqlite ADDED
Binary file (20.5 kB). View file
 
test_database/customer_complaints/schema.sql ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PRAGMA foreign_keys = ON;
2
+
3
+
4
+ CREATE TABLE `Staff` (
5
+ `staff_id` INTEGER PRIMARY KEY,
6
+ `gender` VARCHAR(1),
7
+ `first_name` VARCHAR(80),
8
+ `last_name` VARCHAR(80),
9
+ `email_address` VARCHAR(255),
10
+ `phone_number` VARCHAR(80)
11
+ );
12
+ INSERT INTO Staff (`staff_id`, `gender`, `first_name`, `last_name`, `email_address`, `phone_number`) VALUES (114, '0', 'Ward', 'Boehm', 'marcelle.ritchie@example.com', '(379)551-0838x146');
13
+ INSERT INTO Staff (`staff_id`, `gender`, `first_name`, `last_name`, `email_address`, `phone_number`) VALUES (115, '1', 'Lucie', 'Lowe', 'ohintz@example.org', '142-311-6503x206');
14
+ INSERT INTO Staff (`staff_id`, `gender`, `first_name`, `last_name`, `email_address`, `phone_number`) VALUES (116, '0', 'Dagmar', 'Erdman', 'wrau@example.com', '345-656-5571');
15
+ INSERT INTO Staff (`staff_id`, `gender`, `first_name`, `last_name`, `email_address`, `phone_number`) VALUES (117, '0', 'Bradly', 'Hahn', 'brett99@example.net', '1-132-839-9409x288');
16
+ INSERT INTO Staff (`staff_id`, `gender`, `first_name`, `last_name`, `email_address`, `phone_number`) VALUES (118, '0', 'Austin', 'Zieme', 'reichel.armani@example.org', '(383)553-1035x20399');
17
+ INSERT INTO Staff (`staff_id`, `gender`, `first_name`, `last_name`, `email_address`, `phone_number`) VALUES (119, '0', 'Dorian', 'Oberbrunner', 'richard.gutkowski@example.com', '155-811-6153');
18
+ INSERT INTO Staff (`staff_id`, `gender`, `first_name`, `last_name`, `email_address`, `phone_number`) VALUES (120, '0', 'Mikel', 'Lynch', 'glen.borer@example.com', '751-262-8424x575');
19
+
20
+
21
+ CREATE TABLE `Customers` (
22
+ `customer_id` INTEGER PRIMARY KEY,
23
+ `customer_type_code` VARCHAR(20) NOT NULL,
24
+ `address_line_1` VARCHAR(80),
25
+ `address_line_2` VARCHAR(80),
26
+ `town_city` VARCHAR(80),
27
+ `state` VARCHAR(80),
28
+ `email_address` VARCHAR(255),
29
+ `phone_number` VARCHAR(80)
30
+ );
31
+ INSERT INTO Customers (`customer_id`, `customer_type_code`, `address_line_1`, `address_line_2`, `town_city`, `state`, `email_address`, `phone_number`) VALUES (113, 'Good Credit Rating', '144 Legros Landing', 'Apt. 551', 'Maryamport', 'Kansas', 'hsteuber@example.org', '06963347450');
32
+ INSERT INTO Customers (`customer_id`, `customer_type_code`, `address_line_1`, `address_line_2`, `town_city`, `state`, `email_address`, `phone_number`) VALUES (114, 'Good Credit Rating', '039 Jedidiah Estate Suite 537', 'Apt. 245', 'Sauerberg', 'Hawaii', 'cayla.satterfield@example.net', '470-803-0244');
33
+ INSERT INTO Customers (`customer_id`, `customer_type_code`, `address_line_1`, `address_line_2`, `town_city`, `state`, `email_address`, `phone_number`) VALUES (115, 'Good Credit Rating', '92189 Gulgowski Ranch Apt. 683', 'Apt. 828', 'Tyreekhaven', 'Tennessee', 'vida86@example.com', '997.698.4779x882');
34
+ INSERT INTO Customers (`customer_id`, `customer_type_code`, `address_line_1`, `address_line_2`, `town_city`, `state`, `email_address`, `phone_number`) VALUES (116, 'Good Credit Rating', '72144 Katlynn Flat Suite 512', 'Suite 959','Hansenbury', 'Tennessee', 'vbogisich@example.org', '548.373.3603x59134');
35
+ INSERT INTO Customers (`customer_id`, `customer_type_code`, `address_line_1`, `address_line_2`, `town_city`, `state`, `email_address`, `phone_number`) VALUES (117, 'Good Credit Rating', '1566 Ramona Overpass Apt. 464', 'Suite 151', 'North Alisaville', 'Florida', 'ubeier@example.org', '044-468-4549');
36
+ INSERT INTO Customers (`customer_id`, `customer_type_code`, `address_line_1`, `address_line_2`, `town_city`, `state`, `email_address`, `phone_number`) VALUES (118, 'Defaults on payments', '425 Roman Tunnel', 'Apt. 495', 'Funkstad', 'Colorado', 'lavonne.frami@example.com', '+38(3)9011433816');
37
+ INSERT INTO Customers (`customer_id`, `customer_type_code`, `address_line_1`, `address_line_2`, `town_city`, `state`, `email_address`, `phone_number`) VALUES (119, 'Good Credit Rating', '05355 Marcelle Radial', 'Suite 054', 'Port Joshuah', 'Pennsylvania', 'paige.hyatt@example.com', '1-369-302-7623x576');
38
+ INSERT INTO Customers (`customer_id`, `customer_type_code`, `address_line_1`, `address_line_2`, `town_city`, `state`, `email_address`, `phone_number`) VALUES (120, 'Defaults on payments', '518 Mann Park', 'Suite 035', 'West Annamariestad', 'Iowa', 'rzulauf@example.org', '578.019.7943x328');
39
+
40
+
41
+ CREATE TABLE `Products` (
42
+ `product_id` INTEGER PRIMARY KEY,
43
+ `parent_product_id` INTEGER,
44
+ `product_category_code` VARCHAR(20) NOT NULL,
45
+ `date_product_first_available` DATETIME,
46
+ `date_product_discontinued` DATETIME,
47
+ `product_name` VARCHAR(80),
48
+ `product_description` VARCHAR(255),
49
+ `product_price` DECIMAL(19,4)
50
+ );
51
+ INSERT INTO Products (`product_id`, `parent_product_id`, `product_category_code`, `date_product_first_available`, `date_product_discontinued`, `product_name`, `product_description`, `product_price`) VALUES (117, 4, 'Food', '1988-09-29 17:54:50', '1987-12-20 13:46:16', 'Chocolate', 'Handmade chocolate', '2.8800');
52
+ INSERT INTO Products (`product_id`, `parent_product_id`, `product_category_code`, `date_product_first_available`, `date_product_discontinued`, `product_name`, `product_description`, `product_price`) VALUES (118, 3, 'Book', '1974-06-25 12:26:47', '1991-08-20 05:22:31', 'The Great Gatsby', 'American novel','35.0000');
53
+ INSERT INTO Products (`product_id`, `parent_product_id`, `product_category_code`, `date_product_first_available`, `date_product_discontinued`, `product_name`, `product_description`, `product_price`) VALUES (119, 8, 'Hardware', '1994-12-18 15:13:19', '1997-07-02 18:26:16', 'Keyboard', 'Designed for games', '109.9900');
54
+ INSERT INTO Products (`product_id`, `parent_product_id`, `product_category_code`, `date_product_first_available`, `date_product_discontinued`, `product_name`, `product_description`, `product_price`) VALUES (120, 9, 'Hardware', '1998-06-20 15:04:11', '1980-06-26 10:40:19', 'Mouse', 'Blue tooth mouse', '23.3500');
55
+
56
+
57
+ CREATE TABLE `Complaints` (
58
+ `complaint_id` INTEGER NOT NULL ,
59
+ `product_id` INTEGER NOT NULL,
60
+ `customer_id` INTEGER NOT NULL,
61
+ `complaint_outcome_code` VARCHAR(20) NOT NULL,
62
+ `complaint_status_code` VARCHAR(20) NOT NULL,
63
+ `complaint_type_code` VARCHAR(20) NOT NULL,
64
+ `date_complaint_raised` DATETIME,
65
+ `date_complaint_closed` DATETIME,
66
+ `staff_id` INTEGER NOT NULL ,
67
+ FOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),
68
+ FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),
69
+ FOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )
70
+ );
71
+ INSERT INTO Complaints (`complaint_id`, `product_id`, `customer_id`, `complaint_outcome_code`, `complaint_status_code`, `complaint_type_code`, `date_complaint_raised`, `date_complaint_closed`, `staff_id`) VALUES (1, 117, 120, 'OK', 'Closed', 'Product Failure', '2002-07-18 10:59:35', '1976-04-19 11:03:06', 114);
72
+ INSERT INTO Complaints (`complaint_id`, `product_id`, `customer_id`, `complaint_outcome_code`, `complaint_status_code`, `complaint_type_code`, `date_complaint_raised`, `date_complaint_closed`, `staff_id`) VALUES (2, 118, 113, 'OK', 'New', 'Product Unusable', '1973-02-10 22:55:56', '2013-09-14 02:59:10', 120);
73
+ INSERT INTO Complaints (`complaint_id`, `product_id`, `customer_id`, `complaint_outcome_code`, `complaint_status_code`, `complaint_type_code`, `date_complaint_raised`, `date_complaint_closed`, `staff_id`) VALUES (3, 119, 114, 'OK', 'New', 'Product Unusable', '2006-10-29 07:08:46', '1995-09-11 14:48:46', 115);
74
+ INSERT INTO Complaints (`complaint_id`, `product_id`, `customer_id`, `complaint_outcome_code`, `complaint_status_code`, `complaint_type_code`, `date_complaint_raised`, `date_complaint_closed`, `staff_id`) VALUES (4, 120, 114, 'OK', 'Closed', 'Product Unusable', '1977-08-06 00:31:19', '1970-10-14 00:57:25', 114);
75
+ INSERT INTO Complaints (`complaint_id`, `product_id`, `customer_id`, `complaint_outcome_code`, `complaint_status_code`, `complaint_type_code`, `date_complaint_raised`, `date_complaint_closed`, `staff_id`) VALUES (5, 117, 118, 'OK', 'Open', 'Product Failure', '2007-10-14 21:50:43', '2000-08-17 17:02:48', 116);
76
+ INSERT INTO Complaints (`complaint_id`, `product_id`, `customer_id`, `complaint_outcome_code`, `complaint_status_code`, `complaint_type_code`, `date_complaint_raised`, `date_complaint_closed`, `staff_id`) VALUES (6, 118, 114, 'OK', 'Open', 'Product Unusable', '1987-07-11 14:40:30', '1975-10-11 05:54:30', 114);
77
+ INSERT INTO Complaints (`complaint_id`, `product_id`, `customer_id`, `complaint_outcome_code`, `complaint_status_code`, `complaint_type_code`, `date_complaint_raised`, `date_complaint_closed`, `staff_id`) VALUES (7, 117, 117, 'OK', 'New', 'Product Unusable', '2002-07-18 10:59:35', '1976-04-19 11:03:06', 118);
78
+ INSERT INTO Complaints (`complaint_id`, `product_id`, `customer_id`, `complaint_outcome_code`, `complaint_status_code`, `complaint_type_code`, `date_complaint_raised`, `date_complaint_closed`, `staff_id`) VALUES (8, 117, 114, 'OK', 'New', 'Product Unusable', '1973-02-10 22:55:56', '2013-09-14 02:59:10', 117);
79
+ INSERT INTO Complaints (`complaint_id`, `product_id`, `customer_id`, `complaint_outcome_code`, `complaint_status_code`, `complaint_type_code`, `date_complaint_raised`, `date_complaint_closed`, `staff_id`) VALUES (9, 117, 116, 'OK', 'New', 'Product Unusable', '2006-10-29 07:08:46', '1995-09-11 14:48:46', 120);
80
+ INSERT INTO Complaints (`complaint_id`, `product_id`, `customer_id`, `complaint_outcome_code`, `complaint_status_code`, `complaint_type_code`, `date_complaint_raised`, `date_complaint_closed`, `staff_id`) VALUES (10, 118, 115, 'OK', 'New', 'Product Unusable', '1977-08-06 00:31:19', '1970-10-14 00:57:25', 114);
81
+ INSERT INTO Complaints (`complaint_id`, `product_id`, `customer_id`, `complaint_outcome_code`, `complaint_status_code`, `complaint_type_code`, `date_complaint_raised`, `date_complaint_closed`, `staff_id`) VALUES (11, 118, 116, 'OK', 'Open', 'Product Unusable', '2007-10-14 21:50:43', '2000-08-17 17:02:48', 115);
82
+ INSERT INTO Complaints (`complaint_id`, `product_id`, `customer_id`, `complaint_outcome_code`, `complaint_status_code`, `complaint_type_code`, `date_complaint_raised`, `date_complaint_closed`, `staff_id`) VALUES (12, 117, 116, 'OK', 'Open', 'Product Unusable', '1987-07-11 14:40:30', '1975-10-11 05:54:30', 114);
83
+
test_database/decoration_competition/schema.sql ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PRAGMA foreign_keys = ON;
2
+
3
+ CREATE TABLE "college" (
4
+ "College_ID" int,
5
+ "Name" text,
6
+ "Leader_Name" text,
7
+ "College_Location" text,
8
+ PRIMARY KEY ("College_ID")
9
+ );
10
+
11
+
12
+
13
+ INSERT INTO "college" VALUES ("1","Saskatchewan School","Ousame Tounkara","Ottawa");
14
+ INSERT INTO "college" VALUES ("2","B.C. School","Ryan Thelwell","Minnesota");
15
+ INSERT INTO "college" VALUES ("3","Calgary School","Andre Arlain","St. Francis Xavier");
16
+ INSERT INTO "college" VALUES ("4","Edmonton School","Samir Chahine","McGill");
17
+ INSERT INTO "college" VALUES ("5","Toronto School","Roger Dunbrack","Western Ontario");
18
+
19
+
20
+ CREATE TABLE "member" (
21
+ "Member_ID" int,
22
+ "Name" text,
23
+ "Country" text,
24
+ "College_ID" int,
25
+ PRIMARY KEY ("Member_ID"),
26
+ FOREIGN KEY ("College_ID") REFERENCES `college`("College_ID")
27
+ );
28
+
29
+
30
+ INSERT INTO "member" VALUES ("1","Jack Nicklaus","United States",1);
31
+ INSERT INTO "member" VALUES ("2","Billy Casper","United States",1);
32
+ INSERT INTO "member" VALUES ("3","Arnold Palmer","Canada",4);
33
+ INSERT INTO "member" VALUES ("4","Tom Watson","United States",4);
34
+ INSERT INTO "member" VALUES ("5","Homero Blancas","United States",2);
35
+ INSERT INTO "member" VALUES ("6","Pat Fitzsimons","Canada",5);
36
+ INSERT INTO "member" VALUES ("7","Bobby Nichols","Canada",5);
37
+ INSERT INTO "member" VALUES ("8","J. C. Snead","Canada",4);
38
+ INSERT INTO "member" VALUES ("9","Lee Trevino","United States",3);
39
+ INSERT INTO "member" VALUES ("10","Tom Weiskopf","United States",3);
40
+
41
+
42
+ CREATE TABLE "round" (
43
+ "Round_ID" int,
44
+ "Member_ID" int,
45
+ "Decoration_Theme" text,
46
+ "Rank_in_Round" int,
47
+ PRIMARY KEY ("Member_ID","Round_ID"),
48
+ FOREIGN KEY ("Member_ID") REFERENCES "member"("Member_ID")
49
+ );
50
+
51
+
52
+ INSERT INTO "round" VALUES (1,1,"Walk on the Moon",1);
53
+ INSERT INTO "round" VALUES (1,2,"Soft Dream",2);
54
+ INSERT INTO "round" VALUES (1,10,"Dark Nights",4);
55
+ INSERT INTO "round" VALUES (2,4,"Sweetie",3);
56
+ INSERT INTO "round" VALUES (2,6,"Summer",2);
57
+ INSERT INTO "round" VALUES (2,9,"Happiness",1);
58
+
test_database/district_spokesman/district_spokesman.sqlite ADDED
Binary file (28.7 kB). View file
 
test_database/dorm_1/dorm_1.sqlite ADDED
Binary file (24.6 kB). View file
 
test_database/election_representative/schema.sql ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PRAGMA foreign_keys = ON;
2
+
3
+ CREATE TABLE "election" (
4
+ "Election_ID" int,
5
+ "Representative_ID" int,
6
+ "Date" text,
7
+ "Votes" real,
8
+ "Vote_Percent" real,
9
+ "Seats" real,
10
+ "Place" real,
11
+ PRIMARY KEY ("Election_ID"),
12
+ FOREIGN KEY ("Representative_ID") REFERENCES `representative`("Representative_ID")
13
+ );
14
+
15
+ CREATE TABLE "representative" (
16
+ "Representative_ID" int,
17
+ "Name" text,
18
+ "State" text,
19
+ "Party" text,
20
+ "Lifespan" text,
21
+ PRIMARY KEY ("Representative_ID")
22
+ );
23
+
24
+ INSERT INTO "representative" VALUES (1,"Dan Quayle","Indiana","Republican","1947–");
25
+ INSERT INTO "representative" VALUES (2,"John Quayle","New York","Democratic","1868–1930");
26
+ INSERT INTO "representative" VALUES (3,"Al Quie","Minnesota","Republican","1923–");
27
+ INSERT INTO "representative" VALUES (4,"James M. Quigley","Pennsylvania","Democratic","1918–");
28
+ INSERT INTO "representative" VALUES (5,"Jimmy Quillen","Tennessee","Republican","1916–2003");
29
+ INSERT INTO "representative" VALUES (6,"Jack Quinn","New York","Republican","1951–");
30
+ INSERT INTO "representative" VALUES (7,"James L. Quinn","Pennsylvania","Democratic","1875–1960");
31
+
32
+ INSERT INTO "election" VALUES (1,1,"July 1942","9423","16.2","6","3");
33
+ INSERT INTO "election" VALUES (2,2,"October 1942","11059","18.5","10","1");
34
+ INSERT INTO "election" VALUES (3,4,"1946","13049","19.5","10","2");
35
+ INSERT INTO "election" VALUES (4,5,"1949","14077","19.5","9","2");
36
+ INSERT INTO "election" VALUES (5,7,"1953","12422","16.0","7","3");
37
+
test_database/film_rank/schema.sql ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ PRAGMA foreign_keys = ON;
3
+
4
+
5
+
6
+ CREATE TABLE "film" (
7
+ "Film_ID" int,
8
+ "Title" text,
9
+ "Studio" text,
10
+ "Director" text,
11
+ "Gross_in_dollar" int,
12
+ PRIMARY KEY ("Film_ID")
13
+ );
14
+
15
+
16
+ INSERT INTO "film" VALUES (1,"ET the Extra-Terrestrial","Universal","Steven Spielberg","435110554");
17
+ INSERT INTO "film" VALUES (2,"Tootsie","Columbia","Sydney Pollack","177200000");
18
+ INSERT INTO "film" VALUES (3,"An Officer and a Gentleman","Paramount / Lorimar","Taylor Hackford","129795554");
19
+ INSERT INTO "film" VALUES (4,"Rocky III","United Artists","Sylvester Stallone","125049125");
20
+ INSERT INTO "film" VALUES (5,"Porky's","20th Century Fox","Bob Clark","109492484");
21
+ INSERT INTO "film" VALUES (6,"Star Trek II: The Wrath of Khan","Paramount","Nicholas Meyer","79912963");
22
+ INSERT INTO "film" VALUES (7,"48 Hrs","Paramount","Walter Hill","78868508");
23
+ INSERT INTO "film" VALUES (8,"Poltergeist","MGM","Tobe Hooper","76606280");
24
+ INSERT INTO "film" VALUES (9,"The Best Little Whorehouse in Texas","Universal / RKO","Colin Higgins","69701637");
25
+ INSERT INTO "film" VALUES (10,"Annie","Columbia / Rastar","John Huston","57059003");
26
+ INSERT INTO "film" VALUES (11,"The Verdict","20th Century Fox","Sidney Lumet","53977250");
27
+ INSERT INTO "film" VALUES (12,"Gandhi","Columbia","Richard Attenborough","52767889");
28
+ INSERT INTO "film" VALUES (13,"First Blood","Orion / Carolco","Ted Kotcheff","47212904");
29
+
30
+
31
+ CREATE TABLE "market" (
32
+ "Market_ID" int,
33
+ "Country" text,
34
+ "Number_cities" int,
35
+ PRIMARY KEY ("Market_ID")
36
+ );
37
+
38
+ INSERT INTO "market" VALUES (1,"Japan",209);
39
+ INSERT INTO "market" VALUES (2,"China",540);
40
+ INSERT INTO "market" VALUES (3,"USA",700);
41
+ INSERT INTO "market" VALUES (4,"Russia",231);
42
+ INSERT INTO "market" VALUES (5,"France",212);
43
+ INSERT INTO "market" VALUES (6,"Poland",453);
44
+
45
+
46
+ CREATE TABLE "film_market_estimation" (
47
+ "Estimation_ID" int,
48
+ "Low_Estimate" real,
49
+ "High_Estimate" real,
50
+ "Film_ID" int,
51
+ "Type" text,
52
+ "Market_ID" int,
53
+ "Year" int,
54
+ PRIMARY KEY ("Estimation_ID"),
55
+ FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
56
+ FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
57
+ );
58
+
59
+
60
+ INSERT INTO "film_market_estimation" VALUES (1,"80000","80400",1,"Mass suicide murder",1,"1945");
61
+ INSERT INTO "film_market_estimation" VALUES (2,"8000","8000",2,"Mass suicide",2,"1944");
62
+ INSERT INTO "film_market_estimation" VALUES (3,"3000","80400",3,"Mass human sacrifice",3,"1487");
63
+ INSERT INTO "film_market_estimation" VALUES (4,"960","960",4,"Mass suicide",2,"1973");
64
+ INSERT INTO "film_market_estimation" VALUES (5,"913","913",4,"Mass suicide murder",1,"1978");
65
+ INSERT INTO "film_market_estimation" VALUES (6,"300","1000",4,"Mass suicide",1,"2000");
66
+ INSERT INTO "film_market_estimation" VALUES (7,"53","53",4,"Mass suicide",1,"1994");
67
+ INSERT INTO "film_market_estimation" VALUES (8,"39","39",1,"Mass suicide",2,"1997");
68
+ INSERT INTO "film_market_estimation" VALUES (9,"16","16",1,"Mass suicide",3,"1995");
69
+
70
+
test_database/flight_2/annotation.json ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "label_id": null,
3
+ "data": [
4
+ {
5
+ "nl": "Find all airlines that have at least one flight out of AXX airport. Report the full name and the abbreviation of each airline\n",
6
+ "id": 0
7
+ },
8
+ {
9
+ "nl": "Find all destinations served from the AXX airport by Northwest. Re- port flight number, airport code and the full name of the airport.\n",
10
+ "id": 1
11
+ },
12
+ {
13
+ "nl": "Find all airports served by ALL five of the airlines listed below: Delta, Frontier, USAir, UAL and Southwest. Report just the airport codes.\n",
14
+ "id": 2
15
+ },
16
+ {
17
+ "nl": "Find all airports that are served by at least three Southwest flights. Report just the three-letter codes of the airports\n",
18
+ "id": 3
19
+ },
20
+ {
21
+ "nl": "Find the number of airports from which airport ANP can be reached with exactly one transfer.\n",
22
+ "id": 4
23
+ },
24
+ {
25
+ "nl": "Find the number of airports from which airport ATE can be reached with at most one transfer. (make sure to exclude ATE itself from the count). Report just the number.\n",
26
+ "id": 5
27
+ },
28
+ {
29
+ "nl": "Find all airports with exactly 17 outgoing flights. Report airport code and the full name of the airport\n",
30
+ "id": 6
31
+ },
32
+ {
33
+ "nl": "For each room report the total revenue for all stays and the average revenue per stay generated by stays in the room that originated in the months of September\n",
34
+ "id": 7
35
+ }
36
+ ],
37
+ "review_id": null
38
+ }
test_database/flight_2/flight_2.json ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "col_data": [
4
+ {
5
+ "column_name": "uid",
6
+ "data_type": "INTEGER",
7
+ "default_column_name": "uid",
8
+ "default_value": null,
9
+ "not_null": 0,
10
+ "primary_key": 1
11
+ },
12
+ {
13
+ "column_name": "Airline",
14
+ "data_type": "TEXT",
15
+ "default_column_name": "Airline",
16
+ "default_value": null,
17
+ "not_null": 0,
18
+ "primary_key": 0
19
+ },
20
+ {
21
+ "column_name": "Abbreviation",
22
+ "data_type": "TEXT",
23
+ "default_column_name": "Abbreviation",
24
+ "default_value": null,
25
+ "not_null": 0,
26
+ "primary_key": 0
27
+ },
28
+ {
29
+ "column_name": "Country",
30
+ "data_type": "TEXT",
31
+ "default_column_name": "Country",
32
+ "default_value": null,
33
+ "not_null": 0,
34
+ "primary_key": 0
35
+ }
36
+ ],
37
+ "table": "airlines"
38
+ },
39
+ {
40
+ "col_data": [
41
+ {
42
+ "column_name": "City",
43
+ "data_type": "TEXT",
44
+ "default_column_name": "City",
45
+ "default_value": null,
46
+ "not_null": 0,
47
+ "primary_key": 0
48
+ },
49
+ {
50
+ "column_name": "AirportCode",
51
+ "data_type": "TEXT",
52
+ "default_column_name": "AirportCode",
53
+ "default_value": null,
54
+ "not_null": 0,
55
+ "primary_key": 1
56
+ },
57
+ {
58
+ "column_name": "AirportName",
59
+ "data_type": "TEXT",
60
+ "default_column_name": "AirportName",
61
+ "default_value": null,
62
+ "not_null": 0,
63
+ "primary_key": 0
64
+ },
65
+ {
66
+ "column_name": "Country",
67
+ "data_type": "TEXT",
68
+ "default_column_name": "Country",
69
+ "default_value": null,
70
+ "not_null": 0,
71
+ "primary_key": 0
72
+ },
73
+ {
74
+ "column_name": "CountryAbbrev",
75
+ "data_type": "TEXT",
76
+ "default_column_name": "CountryAbbrev",
77
+ "default_value": null,
78
+ "not_null": 0,
79
+ "primary_key": 0
80
+ }
81
+ ],
82
+ "table": "airports100"
83
+ },
84
+ {
85
+ "col_data": [
86
+ {
87
+ "column_name": "Airline",
88
+ "data_type": "INTEGER",
89
+ "default_column_name": "Airline",
90
+ "default_value": null,
91
+ "not_null": 0,
92
+ "primary_key": 1
93
+ },
94
+ {
95
+ "column_name": "FlightNo",
96
+ "data_type": "INTEGER",
97
+ "default_column_name": "FlightNo",
98
+ "default_value": null,
99
+ "not_null": 0,
100
+ "primary_key": 2
101
+ },
102
+ {
103
+ "column_name": "SourceAirport",
104
+ "data_type": "TEXT",
105
+ "default_column_name": "SourceAirport",
106
+ "default_value": null,
107
+ "not_null": 0,
108
+ "primary_key": 0
109
+ },
110
+ {
111
+ "column_name": "DestAirport",
112
+ "data_type": "TEXT",
113
+ "default_column_name": "DestAirport",
114
+ "default_value": null,
115
+ "not_null": 0,
116
+ "primary_key": 0
117
+ }
118
+ ],
119
+ "table": "flights"
120
+ }
121
+ ]
test_database/flight_2/flight_2.sqlite ADDED
Binary file (77.8 kB). View file
 
test_database/flight_2/link.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ http://users.csc.calpoly.edu/~dekhtyar/365-Spring2017/index.html
test_database/flight_2/q.txt ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Find all airlines that have at least one flight out of AXX airport. Report the full name and the abbreviation of each airline
2
+
3
+ Find all destinations served from the AXX airport by Northwest. Re- port flight number, airport code and the full name of the airport.
4
+
5
+ Find all airports served by ALL five of the airlines listed below: Delta, Frontier, USAir, UAL and Southwest. Report just the airport codes.
6
+
7
+ Find all airports that are served by at least three Southwest flights. Report just the three-letter codes of the airports
8
+
9
+ Find the number of airports from which airport ANP can be reached with exactly one transfer.
10
+
11
+ Find the number of airports from which airport ATE can be reached with at most one transfer. (make sure to exclude ATE itself from the count). Report just the number.
12
+
13
+ Find all airports with exactly 17 outgoing flights. Report airport code and the full name of the airport
14
+
15
+ For each room report the total revenue for all stays and the average revenue per stay generated by stays in the room that originated in the months of September
test_database/flight_4/flight_4.sqlite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4885150ab97173411aee5b73009ac2a28ce1748ce1218331608b939d9d54330e
3
+ size 3129344
test_database/game_1/game_1.sqlite ADDED
Binary file (20.5 kB). View file
 
test_database/gymnast/schema.sql ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PRAGMA foreign_keys = ON;
2
+
3
+ CREATE TABLE "gymnast" (
4
+ "Gymnast_ID" int,
5
+ "Floor_Exercise_Points" real,
6
+ "Pommel_Horse_Points" real,
7
+ "Rings_Points" real,
8
+ "Vault_Points" real,
9
+ "Parallel_Bars_Points" real,
10
+ "Horizontal_Bar_Points" real,
11
+ "Total_Points" real,
12
+ PRIMARY KEY ("Gymnast_ID"),
13
+ FOREIGN KEY ("Gymnast_ID") REFERENCES "people"("People_ID")
14
+ );
15
+
16
+ CREATE TABLE "people" (
17
+ "People_ID" int,
18
+ "Name" text,
19
+ "Age" real,
20
+ "Height" real,
21
+ "Hometown" text,
22
+ PRIMARY KEY ("People_ID")
23
+ );
24
+
25
+
26
+ INSERT INTO "people" VALUES (1,"Paul Hamm","24","1.71","Santo Domingo");
27
+ INSERT INTO "people" VALUES (2,"Lorraine Súarez Carmona","21","1.75","Bonao");
28
+ INSERT INTO "people" VALUES (3,"Ashley Pérez Cabrera","19","1.70","Miami");
29
+ INSERT INTO "people" VALUES (4,"Elizabeth Quiñónez Aroyo","20","1.71","Santo Domingo");
30
+ INSERT INTO "people" VALUES (5,"Eve Tatiana Cruz Oviedo","19","1.72","Santo Domingo");
31
+ INSERT INTO "people" VALUES (6,"Nadia Caba Rodríguez","22","1.79","Santo Domingo");
32
+ INSERT INTO "people" VALUES (7,"Clary Sermina Delgado Cid","21","1.75","Santiago de los Caballeros");
33
+ INSERT INTO "people" VALUES (8,"Marina Castro Medina","20","1.76","Santo Domingo");
34
+ INSERT INTO "people" VALUES (9,"Rosa Clarissa Ortíz Melo","23","1.81","La Romana");
35
+ INSERT INTO "people" VALUES (10,"Endis de los Santos Álvarez","24","1.72","Los Alcarrizos");
36
+
37
+
38
+ INSERT INTO "gymnast" VALUES ("1","9.725","9.737","9.512","9.575","9.762","9.750","58.061");
39
+ INSERT INTO "gymnast" VALUES ("2","9.700","9.625","9.625","9.650","9.587","9.737","57.924");
40
+ INSERT INTO "gymnast" VALUES ("4","8.987","9.750","9.750","9.650","9.787","9.725","57.649");
41
+ INSERT INTO "gymnast" VALUES ("6","9.762","9.325","9.475","9.762","9.562","9.550","57.436");
42
+ INSERT INTO "gymnast" VALUES ("7","9.687","9.675","9.300","9.537","9.725","9.500","57.424");
43
+ INSERT INTO "gymnast" VALUES ("8","9.650","9.712","9.487","9.637","9.500","9.412","57.398");
44
+ INSERT INTO "gymnast" VALUES ("10","9.412","9.525","9.712","9.550","9.625","9.550","57.374");
45
+
test_database/imdb/imdb.sqlite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c84df167fd43cd471701ddc4ae9bbcbc146fc7fbe11abff0fd75dbe0c30741e7
3
+ size 131072
test_database/inn_1/change_date.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ month_to_name={
3
+ 'JAN' : "01",
4
+ 'FEB' : "02",
5
+ 'MAR' : "03",
6
+ 'APR' : "04",
7
+ 'MAY' : "05",
8
+ 'JUN' : "06",
9
+ 'JUL' : "07",
10
+ 'AUG' : "08",
11
+ 'SEP' : "09",
12
+ 'OCT' : "10",
13
+ 'NOV' : "11",
14
+ 'DEC' : "12"
15
+ };
16
+ df = pd.read_csv('./data_csv/Reservations.csv')
17
+ def change_date(x):
18
+ x = x.split("-")
19
+ x[2] = "20"+x[2][:len(x[2])-1]
20
+ x[1] = month_to_name[x[1]]
21
+ x = "-".join([x[2],x[1],x[0][1:]])
22
+ print x
23
+ return x
24
+ df["CheckIn"] = df["CheckIn"].apply(change_date)
25
+ df["CheckOut"] = df["CheckOut"].apply(change_date)
26
+ df.to_csv('./data_csv/Reservations_t.csv', encoding='utf-8', index=False)