-
Notifications
You must be signed in to change notification settings - Fork 0
/
BusinessVenture.sql
66 lines (56 loc) · 1.34 KB
/
BusinessVenture.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
CREATE TABLE [User] (
[id] int PRIMARY KEY NOT NULL,
[Email] varcharacter NOT NULL,
[FirebaseUserId] varcharacter NOT NULL,
[Name] varcharacter NOT NULL
)
GO
CREATE TABLE [Business] (
[id] int PRIMARY KEY,
[userId] int(fk),
[businessTypeId] int(fk),
[equipment] varcharacter,
[logo] varcharacter,
[title] varcharacter,
[location] varcharacter,
[slogan] varcharacter
)
GO
CREATE TABLE [BusinessType] (
[id] int PRIMARY KEY,
[type] varcharacter
)
GO
CREATE TABLE [ProductOrService] (
[id] int PRIMARY KEY,
[businessId] int(fk),
[nameOfProductOrService] varcharacter,
[cost] int
)
GO
CREATE TABLE [Staff] (
[id] int PRIMARY KEY,
[name] varcharacter,
[email] varcharacter,
[phoneNumber] int,
[address] varcharacter
)
GO
CREATE TABLE [BusinessStaff] (
[id] int PRIMARY KEY,
[businessId] int(fk),
[staffId] int(fk),
[dateEmployed] date,
[positionTitle] varcharacter
)
GO
ALTER TABLE [Business] ADD FOREIGN KEY ([userId]) REFERENCES [User] ([id])
GO
ALTER TABLE [Business] ADD FOREIGN KEY ([businessTypeId]) REFERENCES [BusinessType] ([id])
GO
ALTER TABLE [Staff] ADD FOREIGN KEY ([id]) REFERENCES [BusinessStaff] ([staffId])
GO
ALTER TABLE [Business] ADD FOREIGN KEY ([id]) REFERENCES [BusinessStaff] ([businessId])
GO
ALTER TABLE [Business] ADD FOREIGN KEY ([id]) REFERENCES [ProductOrService] ([businessId])
GO