-
Notifications
You must be signed in to change notification settings - Fork 0
/
shoppingmall_createdatabase.sql
59 lines (47 loc) · 1.19 KB
/
shoppingmall_createdatabase.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
use ShoppingMall
--Create Table [dbo].[Products]
--(
--[Id] INT Identity (1,1) Not Null,
--[ProductName] nVarchar(20) Not Null,
--[Unitprice] money Not Null,
--[UnitInStock] int Not Null
--);
Alter Table [Products]
add[CategoryId] int not null
Alter Table [Products]
add[StoreId] int not null
Create Table [dbo].[Categories]
(
[Id] INT Identity (1,1) Not Null,
[CategoryName] nVarchar(30) Not Null
);
Create Table [dbo].[Customers]
(
[Id] INT Identity (1,1) Not Null,
[FirstName] nVarchar(30) Not Null,
[LastName] nVarchar(30) Not Null,
[Phone] nVarchar(30) Not Null
);
--Create Table [dbo].[Stores]
--(
--[Id] INT Identity (1,1) Not Null,
--[StoreName] nVarchar(30) Not Null,
--[ContactName] nVarchar(30) Not Null,
--[Phone] nVarchar(30) Not Null,
--[Adress] nVarchar(30) Not Null
--);
Alter Table [Stores]
add[ProductId] int not null
Alter Table Stores
drop column [ProductId]
Create Table [dbo].[Orders]
(
[Id] INT Identity (1,1) Not Null,
[Quantity] int Not Null
);
Create Table AssignedorderToCustomers(
[Id] int identity(1,1) not null,
[OrderId] int not null,
[CustomerId] int not null ,
[StoreId] int not null
);