| 26 | -- Create TRANSACTION table |
| 27 | CREATE TABLE transaction ( |
| 28 | transaction_id SERIAL PRIMARY KEY, |
| 29 | transaction_name VARCHAR(100), |
| 30 | amount DECIMAL(10, 2) NOT NULL, |
| 31 | net_amount DECIMAL(10, 2), |
| 32 | date TIMESTAMPTZ NOT NULL |
| 33 | ); |
| 34 | |
33 | | -- Create TRANSACTION table |
34 | | CREATE TABLE transaction ( |
35 | | transaction_id SERIAL PRIMARY KEY, |
36 | | transaction_name VARCHAR(100), |
37 | | amount DECIMAL(10, 2) NOT NULL, |
38 | | net_amount DECIMAL(10, 2), |
39 | | date TIMESTAMPTZ, |
40 | | tag_id INT REFERENCES tag(tag_id) |
| 41 | -- Create TAG_ASSIGNED_TO_TRANSACTION table |
| 42 | CREATE TABLE tag_assigned_to_transaction ( |
| 43 | tag_assigned_to_transaction_id SERIAL PRIMARY KEY, |
| 44 | transaction_id INT NOT NULL REFERENCES transaction(transaction_id) ON DELETE CASCADE, |
| 45 | tag_id INT NOT NULL REFERENCES tag(tag_id) ON DELETE CASCADE |