-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.sql
More file actions
39 lines (34 loc) · 1.29 KB
/
init.sql
File metadata and controls
39 lines (34 loc) · 1.29 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
-- -- USE db_system;
-- -- Drop tables if they exist
-- DROP TABLE IF EXISTS db_system.expenses;
-- DROP TABLE IF EXISTS db_system.categories;
-- -- Create categories table
-- -- CREATE TABLE categories (
-- -- id BIGINT PRIMARY KEY AUTO_INCREMENT,
-- -- name VARCHAR(100) NOT NULL
-- -- );
-- -- -- Create expenses table with foreign key reference
-- -- CREATE TABLE expenses (
-- -- id BIGINT PRIMARY KEY AUTO_INCREMENT,
-- -- description VARCHAR(100) NOT NULL,
-- -- amount DECIMAL(10, 2) NOT NULL,
-- -- date DATE NOT NULL,
-- -- category_id BIGINT,
-- -- FOREIGN KEY (category_id) REFERENCES categories(id)
-- -- );
-- -- Insert predefined categories
-- INSERT INTO db_system.categories (name) VALUES
-- ('Food'),
-- ('Transport'),
-- ('Health'),
-- ('Education'),
-- ('Entertainment'),
-- ('Others');
-- -- Insert sample expenses with category references
-- INSERT INTO db_system.expenses (description, amount, date, category_id) VALUES
-- ('Almoço no iFood', 30.00, '2023-01-01', 1),
-- ('Uber', 12.50, '2023-01-02', 2),
-- ('Compras na farmácia', 52.35, '2023-01-03', 3),
-- ('Livros na Amazon', 44.75, '2023-01-04', 4),
-- ('Ingresso do cinema', 15.20, '2023-01-05', 5),
-- ('Crédito no celular', 30.00, '2023-01-06', 6);