-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathseed.sql
More file actions
61 lines (57 loc) · 2.04 KB
/
seed.sql
File metadata and controls
61 lines (57 loc) · 2.04 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
50
51
52
53
54
55
56
57
58
59
60
61
-- =============================================================
-- Seed data for Section 13 — CTEs
-- =============================================================
SET search_path TO adv_cte;
-- Org chart:
-- Ada (CEO)
-- ├── Alan (CTO)
-- │ ├── Grace (Eng Manager)
-- │ │ ├── Linus (Senior Engineer)
-- │ │ └── Donald (Engineer)
-- │ └── Dennis (Principal Engineer)
-- └── Margaret (COO)
-- ├── Katherine (Ops Lead)
-- └── Radia (Operations)
INSERT INTO employee (full_name, title, manager_id, salary) VALUES
('Ada Lovelace', 'CEO', NULL, 200000), -- 1
('Alan Turing', 'CTO', 1, 180000), -- 2
('Grace Hopper', 'Engineering Manager',2, 140000), -- 3
('Linus Torvalds', 'Senior Engineer', 3, 120000), -- 4
('Donald Knuth', 'Engineer', 3, 95000), -- 5
('Dennis Ritchie', 'Principal Engineer', 2, 150000), -- 6
('Margaret Hamilton', 'COO', 1, 175000), -- 7
('Katherine Johnson', 'Ops Lead', 7, 110000), -- 8
('Radia Perlman', 'Operations', 7, 85000); -- 9
-- Category tree:
-- Electronics
-- ├── Computers
-- │ ├── Laptops
-- │ └── Desktops
-- └── Audio
-- ├── Headphones
-- └── Speakers
-- Home
-- └── Kitchen
-- ├── Ovens
-- └── Blenders
INSERT INTO category (name, parent_id) VALUES
('Electronics', NULL), -- 1
('Computers', 1), -- 2
('Laptops', 2), -- 3
('Desktops', 2), -- 4
('Audio', 1), -- 5
('Headphones', 5), -- 6
('Speakers', 5), -- 7
('Home', NULL), -- 8
('Kitchen', 8), -- 9
('Ovens', 9), -- 10
('Blenders', 9); -- 11
INSERT INTO sale (sold_at, amount_cents) VALUES
('2026-01-05', 14999),
('2026-01-12', 9900),
('2026-02-03', 22500),
('2026-02-14', 18000),
('2026-02-28', 12000),
('2026-03-05', 25000),
('2026-03-18', 8000),
('2026-03-29', 30000);