-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTable Queries.txt
63 lines (48 loc) · 1.09 KB
/
Table Queries.txt
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
ALTER TABLE [User]
ADD Name VARCHAR(100)
create table UserRole(
id int identity(1,1) primary key,
RoleName varchar(20)
)
INSERT INTO [userrole] (RoleName)
VALUES
('End User'),
('Super User');
create table UserRoleMapping(
id int identity(1,1) primary key,
UserId int not null,
userroleid int not null,
FOREIGN Key(UserId) REFERENCES [User](id),
FOREIGN key (userroleid) references userrole(id)
)
create table [SecurityAttribute]
(
id int identity(1,1) primary key,
userid int,
jwttoken nvarchar(1000),
FOREIGN Key(UserId) REFERENCES [User](id),
)
create table [Products] (
id int identity(1,1) primary key,
Name Varchar(100),
Price int,
Description Varchar(100),
ProductSku Varchar(100),
Published int,
Deleted int,
Rowversion rowversion
)
create table [ProductInventory]
(
Id int identity(1,1),
ProductId int,
TotalQuantity int,
AvailableQuantity int
Foreign Key(ProductID) references Products(id)
)
ALTER TABLE [productinventory]
ADD Rowversion ROWVERSION;
insert into [ProductInventory](productid,totalquantity,availablequantity) values
(1,10,10)
ALTER TABLE [products]
ALTER COLUMN deleted BIT;