-
Notifications
You must be signed in to change notification settings - Fork 0
/
CreateTables.sql
47 lines (42 loc) · 1.33 KB
/
CreateTables.sql
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
CREATE TABLE IF NOT EXISTS ProjUser(
UserID VARCHAR(40) NOT NULL,
HashedPassword VARCHAR(255) NOT NULL,
Salt VARCHAR(10) NOT NULL,
FirstName VARCHAR(40) NOT NULL,
LastName VARCHAR(40) NOT NULL,
PRIMARY KEY (UserID)
);
CREATE TABLE IF NOT EXISTS ProjStateTax(
StateBracketID INT NOT NULL AUTO_INCREMENT,
StateID CHAR(2) NOT NULL,
MinIncome INT NOT NULL,
MaxIncome INT NOT NULL,
Percent FLOAT NOT NULL,
PRIMARY KEY (StateBracketID)
);
CREATE TABLE IF NOT EXISTS ProjFedTax(
FedBracketID INT NOT NULL AUTO_INCREMENT,
MinIncome INT NOT NULL,
MaxIncome INT NOT NULL,
Percent FLOAT NOT NULL,
PRIMARY KEY (FedBracketID)
);
CREATE TABLE IF NOT EXISTS ProjBudget(
BudgetID INT NOT NULL AUTO_INCREMENT,
UserID VARCHAR(40) NOT NULL,
Salary INT NOT NULL,
FedBracketID INT NOT NULL,
StateBracketID INT NOT NULL,
FOREIGN KEY(UserID) REFERENCES ProjUser(UserID),
FOREIGN KEY(FedBracketID) REFERENCES ProjFedTax(FedBracketID),
FOREIGN KEY(StateBracketID) REFERENCES ProjStateTax(StateBracketID),
PRIMARY KEY(BudgetID)
);
CREATE TABLE IF NOT EXISTS ProjSplit(
SplitID INT NOT NULL AUTO_INCREMENT,
BudgetID INT NOT NULL,
Name VARCHAR(40),
Percent FLOAT NOT NULL,
FOREIGN KEY(BudgetID) REFERENCES ProjBudget(BudgetID),
PRIMARY KEY(SplitID)
);