-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.sql
More file actions
118 lines (114 loc) · 10.6 KB
/
Copy pathscript.sql
File metadata and controls
118 lines (114 loc) · 10.6 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
CREATE DATABASE SystemWPF
GO
USE [SystemWPF]
GO
/****** Object: Table [dbo].[Order] Script Date: 08.06.2025 13:50:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Order](
[id_order] [int] IDENTITY(1,1) NOT NULL,
[name] [nvarchar](50) NOT NULL,
[brand] [nvarchar](50) NOT NULL,
[price] [int] NOT NULL,
[category] [nvarchar](50) NOT NULL,
[id_user] [int] NOT NULL,
CONSTRAINT [PK_Order] PRIMARY KEY CLUSTERED
(
[id_order] 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].[OrderDetails] Script Date: 08.06.2025 13:50:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[OrderDetails](
[id_orderdetails] [int] IDENTITY(1,1) NOT NULL,
[id_order] [int] NOT NULL,
[id_product] [int] NOT NULL,
CONSTRAINT [PK_OrderDetails] PRIMARY KEY CLUSTERED
(
[id_orderdetails] 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].[Product] Script Date: 08.06.2025 13:50:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Product](
[id_product] [int] IDENTITY(1,1) NOT NULL,
[name] [nvarchar](50) NOT NULL,
[brand] [nvarchar](50) NOT NULL,
[price] [int] NOT NULL,
[category] [nvarchar](50) NOT NULL,
CONSTRAINT [PK_Product] PRIMARY KEY CLUSTERED
(
[id_product] 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].[User] Script Date: 08.06.2025 13:50:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[User](
[id_user] [int] IDENTITY(1,1) NOT NULL,
[login] [nvarchar](50) NOT NULL,
[password] [nvarchar](50) NOT NULL,
[role] [nvarchar](50) NOT NULL,
[fio] [nvarchar](60) NULL,
[card] [nvarchar](50) NULL,
CONSTRAINT [PK_User] PRIMARY KEY CLUSTERED
(
[id_user] 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].[Order] ON
INSERT [dbo].[Order] ([id_order], [name], [brand], [price], [category], [id_user]) VALUES (1, N'Rename 51', N'HONOR', 23000, N'Phone', 3)
INSERT [dbo].[Order] ([id_order], [name], [brand], [price], [category], [id_user]) VALUES (3, N'BV 5100', N'BlackView', 12500, N'Phone', 2)
INSERT [dbo].[Order] ([id_order], [name], [brand], [price], [category], [id_user]) VALUES (4, N'Rename 51', N'HONOR', 23000, N'Phone', 1)
INSERT [dbo].[Order] ([id_order], [name], [brand], [price], [category], [id_user]) VALUES (6, N'Nemori 43', N'POCO', 28000, N'Phone', 2)
INSERT [dbo].[Order] ([id_order], [name], [brand], [price], [category], [id_user]) VALUES (7, N'BV 5100', N'BlackView', 12500, N'Phone', 2)
SET IDENTITY_INSERT [dbo].[Order] OFF
GO
SET IDENTITY_INSERT [dbo].[OrderDetails] ON
INSERT [dbo].[OrderDetails] ([id_orderdetails], [id_order], [id_product]) VALUES (1, 1, 1)
INSERT [dbo].[OrderDetails] ([id_orderdetails], [id_order], [id_product]) VALUES (2, 3, 6)
INSERT [dbo].[OrderDetails] ([id_orderdetails], [id_order], [id_product]) VALUES (3, 4, 1)
SET IDENTITY_INSERT [dbo].[OrderDetails] OFF
GO
SET IDENTITY_INSERT [dbo].[Product] ON
INSERT [dbo].[Product] ([id_product], [name], [brand], [price], [category]) VALUES (1, N'Rename 51', N'HONOR', 23000, N'Phone')
INSERT [dbo].[Product] ([id_product], [name], [brand], [price], [category]) VALUES (2, N'Nemori 43', N'POCO', 28000, N'Phone')
INSERT [dbo].[Product] ([id_product], [name], [brand], [price], [category]) VALUES (6, N'BV 5100', N'BlackView', 12500, N'Phone')
INSERT [dbo].[Product] ([id_product], [name], [brand], [price], [category]) VALUES (8, N'Rizari', N'Honor', 14200, N'telephone')
SET IDENTITY_INSERT [dbo].[Product] OFF
GO
SET IDENTITY_INSERT [dbo].[User] ON
INSERT [dbo].[User] ([id_user], [login], [password], [role], [fio], [card]) VALUES (1, N'admin', N'admin', N'Admin', N'Шаров Матвей Михайлович', N'2940134047002450')
INSERT [dbo].[User] ([id_user], [login], [password], [role], [fio], [card]) VALUES (2, N'shar', N'4321', N'User', N'Шаров Сергей Артемович', N'2370 1280 8900 6745')
INSERT [dbo].[User] ([id_user], [login], [password], [role], [fio], [card]) VALUES (3, N'valer', N'valer', N'User', N'-', N'-')
SET IDENTITY_INSERT [dbo].[User] OFF
GO
ALTER TABLE [dbo].[Order] WITH CHECK ADD CONSTRAINT [FK_Order_User] FOREIGN KEY([id_user])
REFERENCES [dbo].[User] ([id_user])
GO
ALTER TABLE [dbo].[Order] CHECK CONSTRAINT [FK_Order_User]
GO
ALTER TABLE [dbo].[OrderDetails] WITH CHECK ADD CONSTRAINT [FK_OrderDetails_Order] FOREIGN KEY([id_order])
REFERENCES [dbo].[Order] ([id_order])
GO
ALTER TABLE [dbo].[OrderDetails] CHECK CONSTRAINT [FK_OrderDetails_Order]
GO
ALTER TABLE [dbo].[OrderDetails] WITH CHECK ADD CONSTRAINT [FK_OrderDetails_Product] FOREIGN KEY([id_product])
REFERENCES [dbo].[Product] ([id_product])
GO
ALTER TABLE [dbo].[OrderDetails] CHECK CONSTRAINT [FK_OrderDetails_Product]
GO