-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate.sql
228 lines (181 loc) · 5.26 KB
/
create.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
CREATE DATABASE Product;
USE Product;
CREATE TABLE Category
(
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(50),
CONSTRAINT PK PRIMARY KEY (id)
) default charset utf8;
CREATE TABLE Producer
(
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(50),
id_address INT NOT NULL,
CONSTRAINT PK PRIMARY KEY (id)
) default charset utf8;
CREATE TABLE Measurement
(
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(50),
description VARCHAR(80),
CONSTRAINT PK PRIMARY KEY (id)
) default charset utf8;
CREATE TABLE Marcup
(
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(50),
percent DOUBLE,
CONSTRAINT PK PRIMARY KEY (id)
) default charset utf8;
CREATE TABLE Address
(
id INT NOT NULL AUTO_INCREMENT,
street VARCHAR(50),
id_city INT,
CONSTRAINT PK PRIMARY KEY (id)
) default charset utf8;
CREATE TABLE City
(
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(50),
id_region INT,
CONSTRAINT PK PRIMARY KEY (id)
) default charset utf8;
CREATE TABLE Region
(
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(50),
id_country INT,
CONSTRAINT PK PRIMARY KEY (id)
) default charset utf8;
CREATE TABLE Country
(
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(50),
CONSTRAINT PK PRIMARY KEY (id)
) default charset utf8;
CREATE TABLE Suplier
(
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(50),
id_address INT,
CONSTRAINT PK PRIMARY KEY (id)
) default charset utf8;
CREATE TABLE Delivery
(
id INT NOT NULL AUTO_INCREMENT,
id_product INT,
id_supplier INT,
price DOUBLE,
quantity INT,
date_of_delivery DATE,
CONSTRAINT PK PRIMARY KEY (id)
) default charset utf8;
CREATE TABLE Sale
(
id INT NOT NULL AUTO_INCREMENT,
id_product INT,
price DOUBLE,
quantity INT,
date_of_sale DATE,
CONSTRAINT PK PRIMARY KEY (id)
) default charset utf8;
CREATE TABLE Product
(
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(50),
id_category INT,
price DOUBLE,
quantity INT,
id_producer INT,
id_measurement INT,
id_marcup INT,
CONSTRAINT PK PRIMARY KEY (id)
) default charset utf8;
INSERT INTO Category(name) VALUES( 'Bakery' );
INSERT INTO Category(name) VALUES( 'Beverage' );
INSERT INTO Category(name) VALUES( 'Nonfood & Pharmacy' );
INSERT INTO Category(name) VALUES( 'Produce & Floral' );
INSERT INTO Category(name) VALUES( 'Deli' );
INSERT INTO Category(name) VALUES( 'Prepared Foods' );
INSERT INTO Category(name) VALUES( 'Meat' );
INSERT INTO Category(name) VALUES( 'Seafood' );
INSERT INTO Country(name) VALUES( 'Ukraine' );
INSERT INTO Country(name) VALUES( 'USA' );
INSERT INTO Country(name) VALUES( 'UK' );
INSERT INTO Country(name) VALUES( 'Germany' );
INSERT INTO Country(name) VALUES( 'France' );
INSERT INTO Country(name) VALUES( 'China' );
INSERT INTO Country(name) VALUES( 'Sweaden' );
INSERT INTO Country(name) VALUES( 'Poland' );
INSERT INTO Country(name) VALUES( 'Japan' );
INSERT INTO Country(name) VALUES( 'Turkey' );
INSERT INTO Country(name) VALUES( 'Italy' );INSERT INTO Country (id, name);
INSERT INTO Country(name) VALUES( 'Netherland' );
INSERT INTO Country(name) VALUES( 'Spain' );
INSERT INTO Country(name) VALUES( 'Portugal' );
INSERT INTO Country(name) VALUES( 'Czech' );
INSERT INTO Country (name) VALUES ('OAE');
INSERT INTO Country (name) VALUES ('Denmark');
INSERT INTO Region (name, id_country)
VALUES ( 'Copenhagen', 17 );
INSERT INTO City (name, id_region)
VALUES ( 'Cobenhavn' , 1 );
INSERT INTO Address (street, id_city)
VALUES ( 'Skoubogade 3', 1 );
INSERT INTO Producer (name, id_address)
VALUES ( 'Conditori La Glace', 1 );
INSERT INTO Region (name, id_country)
VALUES ( 'Great London', 3 );
INSERT INTO City ( name, id_region)
VALUES ( 'London', 2 );
INSERT INTO Address (street, id_city)
VALUES ( 'Dean St. 60', 2 );
INSERT INTO Producer (name, id_address)
VALUES ( 'MAITRE CHOUX', 2 );
INSERT INTO Region (name, id_country)
VALUES ( 'Noord Holland', 12 );
INSERT INTO City (name, id_region)
VALUES ( 'Amsterdam', 3 );
INSERT INTO Address (street, id_city)
VALUES ( 'Heisteeg 4', 3 );
INSERT INTO Producer (name, id_address)
VALUES ( 'VAN STAPELE', 3 );
INSERT INTO Region (name, id_country)
VALUES ( 'Central Moravia', 15 );
INSERT INTO City (name, id_region)
VALUES ( 'Prague', 4 );
INSERT INTO Address (street, id_city)
VALUES ( 'Karlova 8', 4 );
INSERT INTO Producer (name, id_address)
VALUES ( 'GOOD FOOD CAFE AND BAKERY', 4 );
INSERT INTO Address (street, id_city)
VALUES ( 'Ryesgade 118', 1 );
INSERT INTO Producer (name, id_address)
VALUES ( 'LECKERBAER', 5 );
INSERT INTO Region (name, id_country)
VALUES ( 'Georgia', 2 );
INSERT INTO City (name, id_region)
VALUES ( 'Atlanta', 5 );
INSERT INTO Address (street, id_city)
VALUES ( '88 W Paces Ferry Rd NW', 5 );
INSERT INTO Producer (name, id_address)
VALUES ( 'The Coca-Cola Company', 6 );
INSERT INTO Country ( name )
VALUES ('switzerland');
INSERT INTO Region (name, id_country)
VALUES ( 'Vaud', 18 );
INSERT INTO City (name, id_region)
VALUES ( 'Vevey', 6 );
INSERT INTO Address (street, id_city)
VALUES ( 'Av. Nestle 55', 6 );
INSERT INTO Producer (name, id_address)
VALUES ( 'Nestle', 7 );
INSERT INTO Producer (name, id_address)
VALUES ( 'Cargill', 8 );
INSERT INTO Address (street, id_city)
VALUES ( 'St. Mechnikova 3', 7 );
INSERT INTO City (name, id_region)
VALUES ( 'Kyiv', 7 );
INSERT INTO Region (name, id_country)
VALUES ( 'Kyiv District', 1 );