You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
787 B
28 lines
787 B
CREATE DATABASE [CompaniesDB];
|
|
GO
|
|
|
|
USE [CompaniesDB];
|
|
GO
|
|
|
|
CREATE TABLE [Companies] (
|
|
[CompanyId] int NOT NULL IDENTITY,
|
|
[Name] nvarchar(max) NOT NULL,
|
|
[ContractStatus] varchar(15) NOT NULL CHECK ([ContractStatus] IN('NotReachedYet', 'Reached', 'Terminated')),
|
|
CONSTRAINT [PK_CompanyId] PRIMARY KEY ([CompanyId])
|
|
);
|
|
GO
|
|
|
|
CREATE TABLE [Users] (
|
|
[UserId] int NOT NULL IDENTITY,
|
|
[CompanyID] int NOT NULL,
|
|
[Name] nvarchar(max) NOT NULL,
|
|
[Login] nvarchar(max) NOT NULL,
|
|
[Password] nvarchar(max) NOT NULL,
|
|
CONSTRAINT [PK_UserId] PRIMARY KEY ([UserId]),
|
|
CONSTRAINT [FK_Users_Companies] FOREIGN KEY (CompanyID) REFERENCES [Companies] (CompanyId) ON DELETE CASCADE
|
|
);
|
|
GO
|
|
|
|
INSERT INTO [Companies] (Name, ContractStatus) VALUES
|
|
('Defend Studio', 'NotReachedYet')
|
|
GO
|