-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
49 lines (39 loc) · 1.05 KB
/
Copy pathschema.sql
File metadata and controls
49 lines (39 loc) · 1.05 KB
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
DROP TABLE IF EXISTS products;
DROP TABLE IF EXISTS categories;
DROP TABLE IF EXISTS areas;
CREATE TABLE areas (
id SERIAL PRIMARY KEY,
name VARCHAR(50) NOT NULL
);
CREATE TABLE categories (
id SERIAL PRIMARY KEY,
name VARCHAR(100) NOT NULL
);
CREATE TABLE products (
id SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
category_id INT REFERENCES categories(id),
area_id INT REFERENCES areas(id),
price NUMERIC(10,2) NOT NULL
);
INSERT INTO areas(name) VALUES
('SPB'),
('MSK'),
('KRD');
INSERT INTO categories(name) VALUES
('Insulation'),
('Aerated Concrete'),
('Cement'),
('Drywall'),
('Brick');
INSERT INTO products(name, category_id, area_id, price) VALUES
('Rockwool Scandic 50mm', 1, 1, 1075),
('Knauf Insulation 50mm', 1, 2, 900),
('Isover Warm House 50mm', 1, 3, 850),
('Aerated Concrete D400 SK', 2, 1, 450),
('Aerated Concrete D400 LSR', 2, 2, 430),
('Cement M500 50kg', 3, 1, 390),
('Cement Euro 50kg', 3, 2, 360),
('Drywall Knauf 12mm', 4, 1, 520),
('Drywall Gyproc 12mm', 4, 2, 500),
('Brick Red Standard', 5, 1, 25);