USE [Kafe2]
GO
/****** Object:  Table [dbo].[CookStatus]    Script Date: 09.04.2022 17:02:24 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CookStatus](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Title] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_CookStatus] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Dish]    Script Date: 09.04.2022 17:02:24 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Dish](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Title] [nvarchar](50) NOT NULL,
	[Cost] [float] NOT NULL,
	[CookTime] [int] NOT NULL,
 CONSTRAINT [PK_Dish] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DishOrder]    Script Date: 09.04.2022 17:02:24 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DishOrder](
	[OrderID] [int] NOT NULL,
	[DishID] [int] NOT NULL,
	[Count] [int] NOT NULL,
 CONSTRAINT [PK_DishOrder] PRIMARY KEY CLUSTERED 
(
	[OrderID] ASC,
	[DishID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Employee]    Script Date: 09.04.2022 17:02:24 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Employee](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[LastName] [nvarchar](50) NOT NULL,
	[FirstName] [nvarchar](50) NOT NULL,
	[MiddleName] [nvarchar](50) NULL,
	[PositionID] [int] NOT NULL,
	[Login] [nvarchar](50) NOT NULL,
	[Password] [nvarchar](50) NOT NULL,
	[StatusID] [int] NOT NULL,
 CONSTRAINT [PK_Employee] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Order]    Script Date: 09.04.2022 17:02:24 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Order](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[CookStatusID] [int] NOT NULL,
	[PayStatysID] [int] NOT NULL,
	[EmployeeID] [int] NOT NULL,
	[TableNumber] [int] NOT NULL,
	[ClientCount] [int] NOT NULL,
 CONSTRAINT [PK_Order] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PayStatus]    Script Date: 09.04.2022 17:02:24 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PayStatus](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Title] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_PayStatus] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Position]    Script Date: 09.04.2022 17:02:24 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Position](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Title] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_Position] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Shift]    Script Date: 09.04.2022 17:02:24 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Shift](
	[EmployeeID] [int] NOT NULL,
	[DateShift] [int] NOT NULL,
 CONSTRAINT [PK_Shift] PRIMARY KEY CLUSTERED 
(
	[EmployeeID] ASC,
	[DateShift] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Status]    Script Date: 09.04.2022 17:02:24 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Status](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Title] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_Status] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[CookStatus] ON 

INSERT [dbo].[CookStatus] ([ID], [Title]) VALUES (1, N'готовится')
INSERT [dbo].[CookStatus] ([ID], [Title]) VALUES (2, N'готов')
SET IDENTITY_INSERT [dbo].[CookStatus] OFF
GO
SET IDENTITY_INSERT [dbo].[Dish] ON 

INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (1, N'опомо (opomo)', 487.37, 15)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (2, N'угюбо (ugyubo)', 339.58, 23)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (3, N'ямуде (yamude)', 1575.34, 47)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (4, N'гисек (gisek)', 4096.03, 12)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (5, N'эмоху (emohu)', 354.88, 52)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (6, N'эзего (ezego)', 4014.9, 52)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (7, N'матит (matit)', 1228.15, 34)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (8, N'абуно (abuno)', 2117.14, 15)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (9, N'югупа (yugupa)', 531.66, 53)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (10, N'амулу (amulu)', 903.58, 25)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (11, N'евако (evako)', 3791.92, 36)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (12, N'етомо (etomo)', 2020.12, 41)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (13, N'акоке (akoke)', 4281.29, 44)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (14, N'фанув (fanuv)', 438.02, 16)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (15, N'уселе (usele)', 1695.43, 52)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (16, N'етите (etite)', 4136.45, 41)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (17, N'исуду (isudu)', 887.18, 24)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (18, N'эриди (eridi)', 277.19, 29)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (19, N'анокэ (anoke)', 2411.02, 69)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (20, N'имала (imala)', 1984.64, 21)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (21, N'асуту (asutu)', 1311.71, 25)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (22, N'алище (alische)', 2894.32, 45)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (23, N'гелоп (gelop)', 1351.61, 20)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (24, N'упити (upiti)', 488.64, 48)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (25, N'ореси (oresi)', 2199.24, 20)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (26, N'югика (yugika)', 470.99, 14)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (27, N'ецюру (ecyuru)', 3980.43, 16)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (28, N'океба (okeba)', 612.75, 14)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (29, N'кюгэг (kyugeg)', 1396.56, 28)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (30, N'якиме (yakime)', 4157.87, 23)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (31, N'ухуди (uhudi)', 3321.17, 34)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (32, N'оруко (oruko)', 3272.78, 43)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (33, N'дагим (dagim)', 3925.89, 36)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (34, N'екуци (ekuci)', 1081.71, 39)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (35, N'енугу (enugu)', 383.54, 41)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (36, N'пирин (pirin)', 837.48, 21)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (37, N'омиби (omibi)', 3579.18, 12)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (38, N'адиве (adive)', 1828.48, 19)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (39, N'пюном (pyunom)', 3405.8, 62)
INSERT [dbo].[Dish] ([ID], [Title], [Cost], [CookTime]) VALUES (40, N'улока (uloka)', 3470.7, 47)
SET IDENTITY_INSERT [dbo].[Dish] OFF
GO
INSERT [dbo].[DishOrder] ([OrderID], [DishID], [Count]) VALUES (1, 2, 3)
GO
SET IDENTITY_INSERT [dbo].[Employee] ON 

INSERT [dbo].[Employee] ([ID], [LastName], [FirstName], [MiddleName], [PositionID], [Login], [Password], [StatusID]) VALUES (19, N'Муравьева', N'Екатерина', N'Кирилловна', 3, N'Elley', N'wzFd4v', 1)
INSERT [dbo].[Employee] ([ID], [LastName], [FirstName], [MiddleName], [PositionID], [Login], [Password], [StatusID]) VALUES (20, N'Матвеева', N'Ева', N'Максимовна', 2, N'Ollay', N'mEwRoQ', 2)
INSERT [dbo].[Employee] ([ID], [LastName], [FirstName], [MiddleName], [PositionID], [Login], [Password], [StatusID]) VALUES (21, N'Новиков', N'Платон', N'Артёмович', 2, N'Blakery', N'tUwVqf', 2)
INSERT [dbo].[Employee] ([ID], [LastName], [FirstName], [MiddleName], [PositionID], [Login], [Password], [StatusID]) VALUES (22, N'Виноградова', N'Василиса', N'Тимофеевна', 1, N'Thokie', N'sv62Cu', 2)
INSERT [dbo].[Employee] ([ID], [LastName], [FirstName], [MiddleName], [PositionID], [Login], [Password], [StatusID]) VALUES (23, N'Сергеев', N'Давид', N'Дмитриевич', 2, N'Edex', N'lZmplZ', 2)
INSERT [dbo].[Employee] ([ID], [LastName], [FirstName], [MiddleName], [PositionID], [Login], [Password], [StatusID]) VALUES (24, N'Куликов', N'Михаил', N'Николаевич', 3, N'Tomseph', N'nHl8DE', 2)
INSERT [dbo].[Employee] ([ID], [LastName], [FirstName], [MiddleName], [PositionID], [Login], [Password], [StatusID]) VALUES (25, N'Хромова', N'Ангелина', N'Дмитриевна', 2, N'Louiecha', N'tDx6Is', 2)
INSERT [dbo].[Employee] ([ID], [LastName], [FirstName], [MiddleName], [PositionID], [Login], [Password], [StatusID]) VALUES (26, N'Федоров', N'Евгений', N'Глебович', 2, N'Bobam', N'Yjqxd3', 1)
INSERT [dbo].[Employee] ([ID], [LastName], [FirstName], [MiddleName], [PositionID], [Login], [Password], [StatusID]) VALUES (27, N'Абрамова', N'Вероника', N'Сергеевна', 2, N'Ausni', N'wbicYa', 2)
INSERT [dbo].[Employee] ([ID], [LastName], [FirstName], [MiddleName], [PositionID], [Login], [Password], [StatusID]) VALUES (28, N'Александров', N'Павел', N'Артёмович', 3, N'Blakeot', N'POtncQ', 2)
INSERT [dbo].[Employee] ([ID], [LastName], [FirstName], [MiddleName], [PositionID], [Login], [Password], [StatusID]) VALUES (29, N'Иванова', N'Анастасия', N'Дмитриевна', 3, N'Oscas', N'zvvDV9', 2)
INSERT [dbo].[Employee] ([ID], [LastName], [FirstName], [MiddleName], [PositionID], [Login], [Password], [StatusID]) VALUES (30, N'Грачев', N'Александр', N'Кириллович', 2, N'Lukethan', N'WUbbSS', 2)
INSERT [dbo].[Employee] ([ID], [LastName], [FirstName], [MiddleName], [PositionID], [Login], [Password], [StatusID]) VALUES (31, N'Сомова', N'Ольга', N'Семёновна', 1, N'Bethala', N'SGRI28', 2)
INSERT [dbo].[Employee] ([ID], [LastName], [FirstName], [MiddleName], [PositionID], [Login], [Password], [StatusID]) VALUES (32, N'Абрамов', N'Павел', N'Миронович', 2, N'Brooketha', N'YdL5dx', 2)
INSERT [dbo].[Employee] ([ID], [LastName], [FirstName], [MiddleName], [PositionID], [Login], [Password], [StatusID]) VALUES (33, N'Киселев', N'Кирилл', N'Кириллович', 3, N'Avasica', N'mF5pSy', 1)
INSERT [dbo].[Employee] ([ID], [LastName], [FirstName], [MiddleName], [PositionID], [Login], [Password], [StatusID]) VALUES (34, N'Захаров', N'Марк', N'Ильич', 2, N'Mato', N'bS5D48', 2)
INSERT [dbo].[Employee] ([ID], [LastName], [FirstName], [MiddleName], [PositionID], [Login], [Password], [StatusID]) VALUES (35, N'Плотникова', N'Анна', N'Марковна', 2, N'Fretha', N'WyhoaP', 2)
SET IDENTITY_INSERT [dbo].[Employee] OFF
GO
SET IDENTITY_INSERT [dbo].[Order] ON 

INSERT [dbo].[Order] ([ID], [CookStatusID], [PayStatysID], [EmployeeID], [TableNumber], [ClientCount]) VALUES (1, 1, 1, 20, 1, 2)
SET IDENTITY_INSERT [dbo].[Order] OFF
GO
SET IDENTITY_INSERT [dbo].[PayStatus] ON 

INSERT [dbo].[PayStatus] ([ID], [Title]) VALUES (1, N'принят')
INSERT [dbo].[PayStatus] ([ID], [Title]) VALUES (2, N'оплачен')
SET IDENTITY_INSERT [dbo].[PayStatus] OFF
GO
SET IDENTITY_INSERT [dbo].[Position] ON 

INSERT [dbo].[Position] ([ID], [Title]) VALUES (1, N'Администратор')
INSERT [dbo].[Position] ([ID], [Title]) VALUES (2, N'Официант')
INSERT [dbo].[Position] ([ID], [Title]) VALUES (3, N'Повар')
SET IDENTITY_INSERT [dbo].[Position] OFF
GO
SET IDENTITY_INSERT [dbo].[Status] ON 

INSERT [dbo].[Status] ([ID], [Title]) VALUES (1, N'Уволен')
INSERT [dbo].[Status] ([ID], [Title]) VALUES (2, N'Работает')
SET IDENTITY_INSERT [dbo].[Status] OFF
GO
ALTER TABLE [dbo].[DishOrder]  WITH CHECK ADD  CONSTRAINT [FK_DishOrder_Dish] FOREIGN KEY([DishID])
REFERENCES [dbo].[Dish] ([ID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[DishOrder] CHECK CONSTRAINT [FK_DishOrder_Dish]
GO
ALTER TABLE [dbo].[DishOrder]  WITH CHECK ADD  CONSTRAINT [FK_DishOrder_Order] FOREIGN KEY([OrderID])
REFERENCES [dbo].[Order] ([ID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[DishOrder] CHECK CONSTRAINT [FK_DishOrder_Order]
GO
ALTER TABLE [dbo].[Employee]  WITH CHECK ADD  CONSTRAINT [FK_Employee_Position] FOREIGN KEY([PositionID])
REFERENCES [dbo].[Position] ([ID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[Employee] CHECK CONSTRAINT [FK_Employee_Position]
GO
ALTER TABLE [dbo].[Employee]  WITH CHECK ADD  CONSTRAINT [FK_Employee_Status] FOREIGN KEY([StatusID])
REFERENCES [dbo].[Status] ([ID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[Employee] CHECK CONSTRAINT [FK_Employee_Status]
GO
ALTER TABLE [dbo].[Order]  WITH CHECK ADD  CONSTRAINT [FK_Order_CookStatus] FOREIGN KEY([CookStatusID])
REFERENCES [dbo].[CookStatus] ([ID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[Order] CHECK CONSTRAINT [FK_Order_CookStatus]
GO
ALTER TABLE [dbo].[Order]  WITH CHECK ADD  CONSTRAINT [FK_Order_Employee] FOREIGN KEY([EmployeeID])
REFERENCES [dbo].[Employee] ([ID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[Order] CHECK CONSTRAINT [FK_Order_Employee]
GO
ALTER TABLE [dbo].[Order]  WITH CHECK ADD  CONSTRAINT [FK_Order_PayStatus] FOREIGN KEY([PayStatysID])
REFERENCES [dbo].[PayStatus] ([ID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[Order] CHECK CONSTRAINT [FK_Order_PayStatus]
GO
ALTER TABLE [dbo].[Shift]  WITH CHECK ADD  CONSTRAINT [FK_Shift_Employee] FOREIGN KEY([EmployeeID])
REFERENCES [dbo].[Employee] ([ID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[Shift] CHECK CONSTRAINT [FK_Shift_Employee]
GO
