-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtable structure.sql
More file actions
93 lines (82 loc) · 2.38 KB
/
table structure.sql
File metadata and controls
93 lines (82 loc) · 2.38 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
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
create table Account
(
AccountId int identity
constraint Account_pk
primary key nonclustered,
firstname varchar(25) not null,
lastname varchar(25) not null,
gender varchar(6),
contactNumber varchar(22) not null,
username varchar(25) not null,
password varchar(50) not null,
accType varchar(10) not null
)
go
exec sp_addextendedproperty 'MS_Description', 'Somone who work in the store this maybe a staff or admin', 'SCHEMA',
'Inventory', 'TABLE', 'Account'
go
create table Location
(
locaId int identity
constraint Location_pk
primary key nonclustered,
name varchar(25) not null
)
go
exec sp_addextendedproperty 'MS_Description',
'This will holds the name of the locations where the product will be put into', 'SCHEMA', 'Inventory', 'TABLE',
'Location'
go
create table Supplier
(
suppId int identity
constraint Supplier_pk
primary key nonclustered,
suppName varchar(25) not null,
contactNumber varchar(22)
)
go
exec sp_addextendedproperty 'MS_Description', 'Holds the suppliers of the store', 'SCHEMA', 'Inventory', 'TABLE',
'Supplier'
go
create table Product
(
productId int identity
constraint Product_pk
primary key nonclustered,
Supplier int
constraint Supplier__fk
references Supplier,
prodName varchar(25) not null,
prodType varchar(15) not null,
prodQty int not null,
prodSold int,
prodPrice decimal(9, 2) not null,
Location int
constraint Location__fk
references Location,
prodShelfLife date not null,
sales decimal(9, 2),
prodImage nvarchar(max)
)
go
exec sp_addextendedproperty 'MS_Description', 'Holds the inforation about the products on the store', 'SCHEMA',
'Inventory', 'TABLE', 'Product'
go
create table Sales
(
salesId int identity
constraint Sales_pk
primary key nonclustered,
product int
constraint Product__fk
references Product,
qtySold int,
date date,
sales decimal(6, 2)
)
go
exec sp_addextendedproperty 'MS_Description',
'This will hold the date when the product was sold and and the current date sale of the product', 'SCHEMA',
'Inventory', 'TABLE', 'Sales'
go