RelationalDesign: dml.sql

File dml.sql, 5.7 KB (added by 233062, 6 days ago)
Line 
1SET search_path TO trekr;
2
3-- ============================
4-- USERS
5-- ============================
6INSERT INTO USERS (user_id, email, username, password) VALUES
7(1, 'dimitar@example.com', 'dimitar_arsov', '$2a$10$examplehash1'),
8(2, 'filip@example.com', 'filip_gavrilovski', '$2a$10$examplehash2'),
9(3, 'marko@example.com', 'marko_markovski', '$2a$10$examplehash3'),
10(4, 'andrej.shumanovski@gmail.com', 'andrej_shumanovski', '1234'),
11(5, 'angelovski.mario222@gmail.com', 'angelovski_mario', '1234'),
12(6, 'ana@example.com', 'ana_ilievska', '$2a$10$examplehash6'),
13(7, 'petar@example.com', 'petar_stojanov', '$2a$10$examplehash7'),
14(8, 'elena@example.com', 'elena_ristova', '$2a$10$examplehash8'),
15(9, 'stefan@example.com', 'stefan_nikolov', '$2a$10$examplehash9'),
16(10, 'ivana@example.com', 'ivana_karapandzova', '$2a$10$examplehash10');
17
18-- ============================
19-- FINANCE
20-- ============================
21INSERT INTO FINANCE_USERS (user_id, spending_budget, saving_budget, investing_budget, donation_budget, credit) VALUES
22(1, 500, 200, 300, 50, 1000),
23(2, 600, 250, 200, 30, 500),
24(3, 400, 150, 250, 20, 0),
25(4, 1000, 500, 500, 100, 2000),
26(5, 700, 300, 200, 40, 800),
27(6, 450, 150, 150, 20, 200),
28(7, 900, 350, 250, 60, 1200),
29(8, 550, 200, 300, 25, 0),
30(9, 800, 300, 400, 50, 1500),
31(10, 650, 250, 200, 30, 400);
32
33INSERT INTO INCOMES (income_id, user_id, date, amount) VALUES
34(1, 1, '2026-01-01', 2000),
35(2, 2, '2026-01-03', 1800),
36(3, 3, '2026-01-05', 2200),
37(4, 4, '2026-01-07', 5000),
38(5, 5, '2026-01-08', 3200),
39(6, 6, '2026-01-10', 1600),
40(7, 7, '2026-01-12', 4100),
41(8, 8, '2026-01-14', 2300),
42(9, 9, '2026-01-16', 3700),
43(10, 10, '2026-01-18', 1900);
44
45-- ============================
46-- TRAINING
47-- ============================
48INSERT INTO TRAINING_USERS (user_id, gender, age, weight) VALUES
49(1, 'Male', 21, 73),
50(2, 'Male', 23, 80),
51(3, 'Male', 22, 78),
52(4, 'Female', 25, 65),
53(5, 'Male', 24, 86),
54(6, 'Female', 22, 58),
55(7, 'Male', 28, 92),
56(8, 'Female', 26, 70),
57(9, 'Male', 30, 83),
58(10, 'Female', 21, 62);
59
60-- ============================
61-- WEIGHT & DAILY INTAKES
62-- ============================
63INSERT INTO WEIGHT_USERS (user_id, weight, height, goal_weight, goal_calories) VALUES
64(1, 73, 181, 70, 2500),
65(2, 80, 185, 75, 2600),
66(3, 78, 180, 74, 2400),
67(4, 65, 170, 60, 2000),
68(5, 86, 188, 80, 2800),
69(6, 58, 165, 55, 1900),
70(7, 92, 190, 85, 3000),
71(8, 70, 172, 66, 2100),
72(9, 83, 179, 78, 2500),
73(10, 62, 168, 58, 2000);
74
75INSERT INTO TRAINING_SESSIONS (training_id, training_user_id, weight_user_id, duration, calories, date, type) VALUES
76(1, 1, 1, 60, 500, '2026-02-01', 'Running'),
77(2, 2, 2, 45, 400, '2026-02-01', 'Cycling'),
78(3, 3, 3, 30, 300, '2026-02-01', 'Swimming'),
79(4, 4, 4, 50, 420, '2026-02-02', 'HIIT'),
80(5, 5, 5, 40, 350, '2026-02-02', 'Strength'),
81(6, 6, 6, 35, 280, '2026-02-02', 'Yoga'),
82(7, 7, 7, 55, 520, '2026-02-03', 'Running'),
83(8, 8, 8, 45, 390, '2026-02-03', 'Cycling'),
84(9, 9, 9, 30, 260, '2026-02-03', 'Rowing'),
85(10, 10, 10, 60, 480, '2026-02-04', 'Swimming');
86
87INSERT INTO DAILY_INTAKES (daily_intake_id, user_id, calories, date) VALUES
88(1, 1, 2400, '2026-02-01'),
89(2, 2, 2500, '2026-02-01'),
90(3, 3, 2300, '2026-02-01'),
91(4, 4, 2100, '2026-02-02'),
92(5, 5, 2750, '2026-02-02'),
93(6, 6, 1850, '2026-02-02'),
94(7, 7, 2950, '2026-02-03'),
95(8, 8, 2050, '2026-02-03'),
96(9, 9, 2450, '2026-02-03'),
97(10, 10, 1950, '2026-02-04');
98
99-- ============================
100-- DISCIPLINE & CUSTOM TRACKING
101-- ============================
102INSERT INTO DISCIPLINE_USERS (user_id, num_tasks, tasks) VALUES
103(1, 2, '["Morning Run","Read Book"]'),
104(2, 1, '["Meditation"]'),
105(3, 3, '["Plan Day","No Sugar","Stretch"]'),
106(4, 2, '["Drink Water","Walk 8k Steps"]'),
107(5, 2, '["Journal","Gym"]'),
108(6, 1, '["Study 1h"]');
109
110INSERT INTO CUSTOM_TRACKING_CATEGORIES (custom_tracking_id, user_id, name, num_tasks, tasks) VALUES
111(1, 1, 'Project Trekr', 2, '["Code Review","Push Updates"]'),
112(2, 2, 'Language Learning', 2, '["Duolingo","Watch Lesson"]'),
113(3, 3, 'Side Hustle', 3, '["Client Outreach","Build Feature","Invoice"]'),
114(4, 5, 'Fitness Plan', 2, '["Protein Target","Sleep 8h"]'),
115(5, 6, 'Exam Prep', 2, '["Practice Problems","Review Notes"]');
116
117-- ============================
118-- TASKS & COMPLETION
119-- ============================
120INSERT INTO TASKS (task_id, name, discipline_user_id, custom_tracking_id) VALUES
121(1, 'Morning Run', 1, NULL),
122(2, 'Read Book', 1, NULL),
123(3, 'Meditation', 2, NULL),
124(4, 'Code Review', NULL, 1),
125(5, 'Push Updates', NULL, 1),
126(6, 'Plan Day', 3, NULL),
127(7, 'No Sugar', 3, NULL),
128(8, 'Stretch', 3, NULL),
129(9, 'Drink Water', 4, NULL),
130(10, 'Walk 8k Steps', 4, NULL),
131(11, 'Journal', 5, NULL),
132(12, 'Gym', 5, NULL),
133(13, 'Duolingo', NULL, 2),
134(14, 'Watch Lesson', NULL, 2),
135(15, 'Practice Problems', NULL, 5);
136
137INSERT INTO DAILY_COMPLETION (daily_completion_id, user_id, date, procent) VALUES
138(1, 1, '2026-02-01', 100),
139(2, 2, '2026-02-01', 50),
140(3, 3, '2026-02-01', 67),
141(4, 4, '2026-02-01', 50),
142(5, 5, '2026-02-02', 100),
143(6, 6, '2026-02-02', 0),
144(7, 7, '2026-02-03', 80),
145(8, 8, '2026-02-03', 60),
146(9, 9, '2026-02-03', 40),
147(10, 10, '2026-02-04', 90);
148
149INSERT INTO TASK_DAILY_COMPLETION (task_id, daily_completion_id) VALUES
150(1, 1),
151(2, 1),
152(3, 2),
153(6, 3),
154(7, 3),
155(9, 4),
156(11, 5),
157(12, 5),
158(13, 8),
159(14, 8),
160(15, 10);
161
162-- ============================
163-- INVESTING
164-- ============================
165INSERT INTO INVESTOR_USERS (user_id) VALUES
166(1), (2), (3), (4), (5), (6);
167
168INSERT INTO ASSETS (asset_id, user_id, ticker_symbol, buy_price, buy_date, quantity) VALUES
169(1, 1, 'AAPL', 150, '2026-01-01',1.5),
170(2, 1, 'TSLA', 700, '2026-01-10',2),
171(3, 2, 'GOOGL', 2800, '2026-01-15',1),
172(4, 3, 'MSFT', 320, '2026-01-20',1),
173(5, 4, 'AMZN', 155, '2026-01-22',1),
174(6, 5, 'NVDA', 610, '2026-01-25',1),
175(7, 6, 'SPY', 480, '2026-01-28',1),
176(8, 1, 'ETH', 2400, '2026-01-30',1);