-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.sql
More file actions
22 lines (20 loc) · 840 Bytes
/
database.sql
File metadata and controls
22 lines (20 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
CREATE TABLE [dbo].[Products] (
[ProductId] INT IDENTITY (1, 1) NOT NULL,
[ProductName] NVARCHAR (50) NOT NULL,
[Importance] INT NOT NULL,
PRIMARY KEY CLUSTERED ([ProductId] ASC)
);
CREATE TABLE [dbo].[Customers] (
[CustomerId] INT IDENTITY (1, 1) NOT NULL,
[Priority] INT NOT NULL,
[Address] NVARCHAR (256) NULL,
PRIMARY KEY CLUSTERED ([CustomerId] ASC)
);
CREATE TABLE [dbo].[Orders] (
[OrderId] INT IDENTITY (1, 1) NOT NULL,
[CustomerId] INT NOT NULL,
[ProductId] INT NOT NULL,
PRIMARY KEY CLUSTERED ([OrderId] ASC),
CONSTRAINT [FK_Orders_Customers] FOREIGN KEY ([CustomerId]) REFERENCES [dbo].[Customers] ([CustomerId]),
CONSTRAINT [FK_Orders_Products] FOREIGN KEY ([ProductId]) REFERENCES [dbo].[Products] ([ProductId])
);