-
Notifications
You must be signed in to change notification settings - Fork 0
/
Database.sql
463 lines (463 loc) · 42.9 KB
/
Database.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
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
USE [master]
GO
/****** Object: Database [TECHSHOP] Script Date: 1/12/2021 10:16:07 AM ******/
CREATE DATABASE [TECHSHOP]
CONTAINMENT = NONE
ON PRIMARY
( NAME = N'TECHSHOP', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\TECHSHOP.mdf' , SIZE = 8192KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB )
LOG ON
( NAME = N'TECHSHOP_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\TECHSHOP_log.ldf' , SIZE = 8192KB , MAXSIZE = 2048GB , FILEGROWTH = 65536KB )
WITH CATALOG_COLLATION = DATABASE_DEFAULT
GO
ALTER DATABASE [TECHSHOP] SET COMPATIBILITY_LEVEL = 150
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [TECHSHOP].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [TECHSHOP] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [TECHSHOP] SET ANSI_NULLS OFF
GO
ALTER DATABASE [TECHSHOP] SET ANSI_PADDING OFF
GO
ALTER DATABASE [TECHSHOP] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [TECHSHOP] SET ARITHABORT OFF
GO
ALTER DATABASE [TECHSHOP] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [TECHSHOP] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [TECHSHOP] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [TECHSHOP] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [TECHSHOP] SET CURSOR_DEFAULT GLOBAL
GO
ALTER DATABASE [TECHSHOP] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [TECHSHOP] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [TECHSHOP] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [TECHSHOP] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [TECHSHOP] SET ENABLE_BROKER
GO
ALTER DATABASE [TECHSHOP] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [TECHSHOP] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [TECHSHOP] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [TECHSHOP] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [TECHSHOP] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [TECHSHOP] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [TECHSHOP] SET HONOR_BROKER_PRIORITY OFF
GO
ALTER DATABASE [TECHSHOP] SET RECOVERY FULL
GO
ALTER DATABASE [TECHSHOP] SET MULTI_USER
GO
ALTER DATABASE [TECHSHOP] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [TECHSHOP] SET DB_CHAINING OFF
GO
ALTER DATABASE [TECHSHOP] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF )
GO
ALTER DATABASE [TECHSHOP] SET TARGET_RECOVERY_TIME = 60 SECONDS
GO
ALTER DATABASE [TECHSHOP] SET DELAYED_DURABILITY = DISABLED
GO
EXEC sys.sp_db_vardecimal_storage_format N'TECHSHOP', N'ON'
GO
ALTER DATABASE [TECHSHOP] SET QUERY_STORE = OFF
GO
USE [TECHSHOP]
GO
/****** Object: Table [dbo].[CHITIETHOADON] Script Date: 1/12/2021 10:16:07 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CHITIETHOADON](
[ID] [varchar](10) NOT NULL,
[SANPHAM] [varchar](10) NOT NULL,
[SOLUONG] [int] NULL,
CONSTRAINT [CHITIETHOADON_PK] PRIMARY KEY CLUSTERED
(
[ID] ASC,
[SANPHAM] 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 ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[CONGVIEC] Script Date: 1/12/2021 10:16:07 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CONGVIEC](
[ID] [varchar](10) NOT NULL,
[TEN] [nvarchar](100) NULL,
[LUONG] [int] NULL,
[THONGTIN] [nvarchar](1000) NULL,
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 ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[HOADON] Script Date: 1/12/2021 10:16:07 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[HOADON](
[ID] [varchar](10) NOT NULL,
[NGAYTAO] [date] NULL,
[NHANVIEN] [varchar](10) NULL,
[KHACHHANG] [varchar](10) NULL,
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 ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[KHACHHANG] Script Date: 1/12/2021 10:16:07 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[KHACHHANG](
[ID] [varchar](10) NOT NULL,
[TEN] [nvarchar](100) NULL,
[NGAYSINH] [date] NULL,
[GIOITINH] [int] NULL,
[SDT] [varchar](10) NULL,
[EMAIL] [varchar](100) NULL,
[MAGIOITHIEU] [int] NULL,
[NGAYTHAMGIA] [date] NULL,
[DIACHI] [nvarchar](100) NULL,
[TINH] [varchar](10) NULL,
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 ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[LOAISANPHAM] Script Date: 1/12/2021 10:16:07 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[LOAISANPHAM](
[ID] [varchar](10) NOT NULL,
[TEN] [nvarchar](100) NULL,
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 ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[MAU] Script Date: 1/12/2021 10:16:07 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[MAU](
[ID] [varchar](10) NOT NULL,
[TEN] [nvarchar](20) NULL,
[MAMAU] [varchar](6) NULL,
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 ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[NHACUNGCAP] Script Date: 1/12/2021 10:16:07 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[NHACUNGCAP](
[ID] [varchar](10) NOT NULL,
[TEN] [nvarchar](100) NULL,
[DIACHI] [nvarchar](100) NULL,
[TINH] [varchar](10) NULL,
[SDT] [nvarchar](10) NULL,
[EMAIL] [varchar](100) NULL,
[THONGTIN] [nvarchar](1000) NULL,
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 ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[NHANVIEN] Script Date: 1/12/2021 10:16:07 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[NHANVIEN](
[ID] [varchar](10) NOT NULL,
[TEN] [nvarchar](100) NULL,
[NGAYSINH] [date] NULL,
[GIOITINH] [int] NULL,
[SDT] [varchar](10) NULL,
[EMAIL] [varchar](100) NULL,
[NGAYLAMVIEC] [date] NULL,
[HESO] [float] NULL,
[PHUCAP] [int] NULL,
[DIACHI] [nvarchar](100) NULL,
[TINH] [varchar](10) NULL,
[CONGVIEC] [varchar](10) NULL,
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 ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[QUOCGIA] Script Date: 1/12/2021 10:16:07 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[QUOCGIA](
[ID] [varchar](10) NOT NULL,
[TEN] [nvarchar](100) NULL,
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 ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[SANPHAM] Script Date: 1/12/2021 10:16:07 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SANPHAM](
[ID] [varchar](10) NOT NULL,
[TEN] [nvarchar](100) NULL,
[GIA] [int] NULL,
[DAI] [float] NULL,
[RONG] [float] NULL,
[CAO] [float] NULL,
[MAU] [varchar](10) NULL,
[KHOILUONG] [float] NULL,
[SOLUONG] [int] NULL,
[NGAYNHAP] [date] NULL,
[THONGTIN] [nvarchar](1000) NULL,
[LOAISANPHAM] [varchar](10) NULL,
[NHACUNGCAP] [varchar](10) NULL,
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 ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[TINH] Script Date: 1/12/2021 10:16:07 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TINH](
[ID] [varchar](10) NOT NULL,
[TEN] [nvarchar](100) NULL,
[QUOCGIA] [varchar](10) NULL,
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 ANSI_PADDING OFF
GO
INSERT [dbo].[CHITIETHOADON] ([ID], [SANPHAM], [SOLUONG]) VALUES (N'HD1', N'SP1', 1)
INSERT [dbo].[CHITIETHOADON] ([ID], [SANPHAM], [SOLUONG]) VALUES (N'HD1', N'SP3', 1)
INSERT [dbo].[CHITIETHOADON] ([ID], [SANPHAM], [SOLUONG]) VALUES (N'HD14286878', N'SP29993973', 2)
INSERT [dbo].[CHITIETHOADON] ([ID], [SANPHAM], [SOLUONG]) VALUES (N'HD14286878', N'SP3', 1)
INSERT [dbo].[CHITIETHOADON] ([ID], [SANPHAM], [SOLUONG]) VALUES (N'HD2', N'SP2', 2)
INSERT [dbo].[CHITIETHOADON] ([ID], [SANPHAM], [SOLUONG]) VALUES (N'HD34984592', N'SP29993973', 1)
INSERT [dbo].[CHITIETHOADON] ([ID], [SANPHAM], [SOLUONG]) VALUES (N'HD34984592', N'SP3', 1)
GO
INSERT [dbo].[CONGVIEC] ([ID], [TEN], [LUONG], [THONGTIN]) VALUES (N'CV1', N'Quản kho', 4000000, N'')
INSERT [dbo].[CONGVIEC] ([ID], [TEN], [LUONG], [THONGTIN]) VALUES (N'CV2', N'Giữ xe', 2200000, N'')
INSERT [dbo].[CONGVIEC] ([ID], [TEN], [LUONG], [THONGTIN]) VALUES (N'CV3', N'Trông hàng', 3200000, N'')
INSERT [dbo].[CONGVIEC] ([ID], [TEN], [LUONG], [THONGTIN]) VALUES (N'CV4', N'Thu ngân', 3900000, N'')
INSERT [dbo].[CONGVIEC] ([ID], [TEN], [LUONG], [THONGTIN]) VALUES (N'CV5', N'Quản lý', 6500000, N'')
GO
INSERT [dbo].[HOADON] ([ID], [NGAYTAO], [NHANVIEN], [KHACHHANG]) VALUES (N'HD1', CAST(N'2020-01-02' AS Date), N'NV1', N'KH5')
INSERT [dbo].[HOADON] ([ID], [NGAYTAO], [NHANVIEN], [KHACHHANG]) VALUES (N'HD14286878', CAST(N'2020-12-02' AS Date), N'NV1', N'KH4')
INSERT [dbo].[HOADON] ([ID], [NGAYTAO], [NHANVIEN], [KHACHHANG]) VALUES (N'HD2', CAST(N'2020-02-03' AS Date), N'NV1', N'KH4')
INSERT [dbo].[HOADON] ([ID], [NGAYTAO], [NHANVIEN], [KHACHHANG]) VALUES (N'HD34984592', CAST(N'2020-12-02' AS Date), N'NV1', N'KH31026002')
GO
INSERT [dbo].[KHACHHANG] ([ID], [TEN], [NGAYSINH], [GIOITINH], [SDT], [EMAIL], [MAGIOITHIEU], [NGAYTHAMGIA], [DIACHI], [TINH]) VALUES (N'KH1', N'Nguyễn Thị Như Quỳnh', CAST(N'1997-11-12' AS Date), 1, N'0965412147', N'[email protected]', 1225744, CAST(N'2019-08-07' AS Date), N'72 Hùng Vương, Quang Trung', N'T1')
INSERT [dbo].[KHACHHANG] ([ID], [TEN], [NGAYSINH], [GIOITINH], [SDT], [EMAIL], [MAGIOITHIEU], [NGAYTHAMGIA], [DIACHI], [TINH]) VALUES (N'KH2', N'Phạm Thanh Hai', CAST(N'1995-10-10' AS Date), 0, N'0367899841', N'[email protected]', 133445, CAST(N'2019-09-10' AS Date), N'66 Nguyễn Tất Thành, Duy Tân', N'T1')
INSERT [dbo].[KHACHHANG] ([ID], [TEN], [NGAYSINH], [GIOITINH], [SDT], [EMAIL], [MAGIOITHIEU], [NGAYTHAMGIA], [DIACHI], [TINH]) VALUES (N'KH3', N'Bành Kỳ Kỳ', CAST(N'1994-06-01' AS Date), 0, N'0965412147', N'[email protected]', 1225744, CAST(N'2019-08-07' AS Date), N'68 Hùng Vương, Quang Trung', N'T1')
INSERT [dbo].[KHACHHANG] ([ID], [TEN], [NGAYSINH], [GIOITINH], [SDT], [EMAIL], [MAGIOITHIEU], [NGAYTHAMGIA], [DIACHI], [TINH]) VALUES (N'KH31026002', N'Hồng Vân', CAST(N'1996-12-13' AS Date), 1, N'039875412', N'[email protected]', 1999999, CAST(N'2020-12-01' AS Date), N'199 Quận 7', N'T2')
INSERT [dbo].[KHACHHANG] ([ID], [TEN], [NGAYSINH], [GIOITINH], [SDT], [EMAIL], [MAGIOITHIEU], [NGAYTHAMGIA], [DIACHI], [TINH]) VALUES (N'KH4', N'Nguyễn Xuân Hoàng', CAST(N'2000-06-05' AS Date), 0, N'0965412147', N'[email protected]', 1997744, CAST(N'2020-10-24' AS Date), N'72 Hùng Vương, Quang Trung', N'T3')
INSERT [dbo].[KHACHHANG] ([ID], [TEN], [NGAYSINH], [GIOITINH], [SDT], [EMAIL], [MAGIOITHIEU], [NGAYTHAMGIA], [DIACHI], [TINH]) VALUES (N'KH5', N'Thu Yến', CAST(N'1997-05-04' AS Date), 1, N'0987987987', N'[email protected]', 655811, CAST(N'2020-08-07' AS Date), N'122 Phan Đình Phùng, Quang Trung', N'T1')
INSERT [dbo].[KHACHHANG] ([ID], [TEN], [NGAYSINH], [GIOITINH], [SDT], [EMAIL], [MAGIOITHIEU], [NGAYTHAMGIA], [DIACHI], [TINH]) VALUES (N'KH6', N'Nguyễn Trúc Giang', CAST(N'2000-12-05' AS Date), 0, N'039888654', N'[email protected]', 655811, CAST(N'2020-07-18' AS Date), N'Không biết, Quang Trung', N'T4')
GO
INSERT [dbo].[LOAISANPHAM] ([ID], [TEN]) VALUES (N'LSP1', N'Laptop')
INSERT [dbo].[LOAISANPHAM] ([ID], [TEN]) VALUES (N'LSP2', N'Điện thoại')
INSERT [dbo].[LOAISANPHAM] ([ID], [TEN]) VALUES (N'LSP3', N'Loa')
INSERT [dbo].[LOAISANPHAM] ([ID], [TEN]) VALUES (N'LSP4', N'Tai nghe')
INSERT [dbo].[LOAISANPHAM] ([ID], [TEN]) VALUES (N'LSP5', N'Sạc')
GO
INSERT [dbo].[MAU] ([ID], [TEN], [MAMAU]) VALUES (N'M1', N'Đỏ', N'ff1100')
INSERT [dbo].[MAU] ([ID], [TEN], [MAMAU]) VALUES (N'M2', N'Đen', N'000000')
INSERT [dbo].[MAU] ([ID], [TEN], [MAMAU]) VALUES (N'M3', N'Trắng', N'ffffff')
INSERT [dbo].[MAU] ([ID], [TEN], [MAMAU]) VALUES (N'M4', N'Xanh dương', N'008cff')
INSERT [dbo].[MAU] ([ID], [TEN], [MAMAU]) VALUES (N'M5', N'Xanh lá cây', N'31f505')
GO
INSERT [dbo].[NHACUNGCAP] ([ID], [TEN], [DIACHI], [TINH], [SDT], [EMAIL], [THONGTIN]) VALUES (N'NCC1', N'Samsung', N'99 Trần Phú, Duy Tân', N'T4', N'098833245', N'[email protected]', N'')
INSERT [dbo].[NHACUNGCAP] ([ID], [TEN], [DIACHI], [TINH], [SDT], [EMAIL], [THONGTIN]) VALUES (N'NCC2', N'Apple', N'225 WasterLane, Wlingster', N'T5', N'0666547874', N'[email protected]', N'')
INSERT [dbo].[NHACUNGCAP] ([ID], [TEN], [DIACHI], [TINH], [SDT], [EMAIL], [THONGTIN]) VALUES (N'NCC3', N'VSmart', N'222 Nguyễn Sinh Thành, Bình Trắc', N'T1', N'0366987441', N'[email protected]', N'')
INSERT [dbo].[NHACUNGCAP] ([ID], [TEN], [DIACHI], [TINH], [SDT], [EMAIL], [THONGTIN]) VALUES (N'NCC4', N'Lenovo', N'12 Không biết, Không có', N'T2', N'0388754145', N'[email protected]', N'')
INSERT [dbo].[NHACUNGCAP] ([ID], [TEN], [DIACHI], [TINH], [SDT], [EMAIL], [THONGTIN]) VALUES (N'NCC5', N'Asus', N'13 Không biết, Không có', N'T2', N'0389755781', N'[email protected]', N'')
INSERT [dbo].[NHACUNGCAP] ([ID], [TEN], [DIACHI], [TINH], [SDT], [EMAIL], [THONGTIN]) VALUES (N'NCC6', N'Dell', N'24 Không biết, Không có', N'T2', N'0368975145', N'[email protected]', N'')
INSERT [dbo].[NHACUNGCAP] ([ID], [TEN], [DIACHI], [TINH], [SDT], [EMAIL], [THONGTIN]) VALUES (N'NCC7', N'Oppo', N'21 Không biết, Không có', N'T2', N'036544781', N'[email protected]', N'')
GO
INSERT [dbo].[NHANVIEN] ([ID], [TEN], [NGAYSINH], [GIOITINH], [SDT], [EMAIL], [NGAYLAMVIEC], [HESO], [PHUCAP], [DIACHI], [TINH], [CONGVIEC]) VALUES (N'NV1', N'Puith Naly', CAST(N'2000-10-30' AS Date), 1, N'0398422145', N'[email protected]', CAST(N'2019-12-22' AS Date), 1, 300000, N'22 Không biết, Ở đâu', N'T3', N'CV4')
INSERT [dbo].[NHANVIEN] ([ID], [TEN], [NGAYSINH], [GIOITINH], [SDT], [EMAIL], [NGAYLAMVIEC], [HESO], [PHUCAP], [DIACHI], [TINH], [CONGVIEC]) VALUES (N'NV2', N'Lê Hạnh', CAST(N'2000-06-12' AS Date), 1, N'0987541124', N'[email protected]', CAST(N'2020-01-12' AS Date), 1, 250000, N'1 Không biết, Ở đâu', N'T3', N'CV3')
INSERT [dbo].[NHANVIEN] ([ID], [TEN], [NGAYSINH], [GIOITINH], [SDT], [EMAIL], [NGAYLAMVIEC], [HESO], [PHUCAP], [DIACHI], [TINH], [CONGVIEC]) VALUES (N'NV3', N'Rmar Sê', CAST(N'2000-11-09' AS Date), 0, N'0398756412', N'[email protected]', CAST(N'2020-01-31' AS Date), 1, 240000, N'Gia Lei', N'T3', N'CV2')
INSERT [dbo].[NHANVIEN] ([ID], [TEN], [NGAYSINH], [GIOITINH], [SDT], [EMAIL], [NGAYLAMVIEC], [HESO], [PHUCAP], [DIACHI], [TINH], [CONGVIEC]) VALUES (N'NV60445901', N'Nguyễn Trà Giang', CAST(N'2000-12-05' AS Date), 1, N'0369874124', N'[email protected]', CAST(N'2020-12-01' AS Date), 3.4, 400000, N'Nhà của Trúc Giang', N'T4', N'CV3')
GO
INSERT [dbo].[QUOCGIA] ([ID], [TEN]) VALUES (N'QG1', N'Việt Nam')
INSERT [dbo].[QUOCGIA] ([ID], [TEN]) VALUES (N'QG2', N'Lào')
INSERT [dbo].[QUOCGIA] ([ID], [TEN]) VALUES (N'QG3', N'Campuchia')
INSERT [dbo].[QUOCGIA] ([ID], [TEN]) VALUES (N'QG4', N'Hoa Kỳ')
GO
INSERT [dbo].[SANPHAM] ([ID], [TEN], [GIA], [DAI], [RONG], [CAO], [MAU], [KHOILUONG], [SOLUONG], [NGAYNHAP], [THONGTIN], [LOAISANPHAM], [NHACUNGCAP]) VALUES (N'SP1', N'Lenovo Ideapad S145 - 14API/R3 3200U', 8320000, 327.1, 241, 19, N'M3', 1.6, 12, CAST(N'2019-05-10' AS Date), N'', N'LSP1', N'NCC4')
INSERT [dbo].[SANPHAM] ([ID], [TEN], [GIA], [DAI], [RONG], [CAO], [MAU], [KHOILUONG], [SOLUONG], [NGAYNHAP], [THONGTIN], [LOAISANPHAM], [NHACUNGCAP]) VALUES (N'SP2', N'Asus TUF FX505DT HN478T R7 3750H/8GB/512GB SSD/Win10', 19490000, 360, 262, 26, N'M2', 2.2, 6, CAST(N'2020-10-16' AS Date), N'', N'LSP1', N'NCC5')
INSERT [dbo].[SANPHAM] ([ID], [TEN], [GIA], [DAI], [RONG], [CAO], [MAU], [KHOILUONG], [SOLUONG], [NGAYNHAP], [THONGTIN], [LOAISANPHAM], [NHACUNGCAP]) VALUES (N'SP29993973', N'Iphone 12 Pro Max', 29790000, 102, 72, 11, N'M2', 0.21, 19, CAST(N'2020-12-02' AS Date), N'', N'LSP2', N'NCC2')
INSERT [dbo].[SANPHAM] ([ID], [TEN], [GIA], [DAI], [RONG], [CAO], [MAU], [KHOILUONG], [SOLUONG], [NGAYNHAP], [THONGTIN], [LOAISANPHAM], [NHACUNGCAP]) VALUES (N'SP3', N'Oppo A53 4GB-128GB', 4490000, 163.9, 75.1, 8.4, N'M4', 0.186, 8, CAST(N'2020-05-11' AS Date), N'', N'LSP2', N'NCC7')
INSERT [dbo].[SANPHAM] ([ID], [TEN], [GIA], [DAI], [RONG], [CAO], [MAU], [KHOILUONG], [SOLUONG], [NGAYNHAP], [THONGTIN], [LOAISANPHAM], [NHACUNGCAP]) VALUES (N'SP43554367', N'Dell WorkStation D990', 32290000, 330, 293, 121, N'M4', 2.34, 3, CAST(N'2020-12-02' AS Date), N'Dell cấu hình mạnh mẽ', N'LSP1', N'NCC6')
GO
INSERT [dbo].[TINH] ([ID], [TEN], [QUOCGIA]) VALUES (N'T1', N'Hà Nội', N'QG1')
INSERT [dbo].[TINH] ([ID], [TEN], [QUOCGIA]) VALUES (N'T2', N'hồ Chí Minh', N'QG1')
INSERT [dbo].[TINH] ([ID], [TEN], [QUOCGIA]) VALUES (N'T3', N'Gia Lai', N'QG1')
INSERT [dbo].[TINH] ([ID], [TEN], [QUOCGIA]) VALUES (N'T4', N'Kon Tum', N'QG1')
INSERT [dbo].[TINH] ([ID], [TEN], [QUOCGIA]) VALUES (N'T5', N'Califonia', N'QG4')
GO
ALTER TABLE [dbo].[CHITIETHOADON] WITH CHECK ADD CONSTRAINT [CHITIETHOADON_ID_FK] FOREIGN KEY([ID])
REFERENCES [dbo].[HOADON] ([ID])
GO
ALTER TABLE [dbo].[CHITIETHOADON] CHECK CONSTRAINT [CHITIETHOADON_ID_FK]
GO
ALTER TABLE [dbo].[CHITIETHOADON] WITH CHECK ADD CONSTRAINT [CHITIETHOADON_SANPHAM_FK] FOREIGN KEY([SANPHAM])
REFERENCES [dbo].[SANPHAM] ([ID])
GO
ALTER TABLE [dbo].[CHITIETHOADON] CHECK CONSTRAINT [CHITIETHOADON_SANPHAM_FK]
GO
ALTER TABLE [dbo].[HOADON] WITH CHECK ADD CONSTRAINT [HOADON_KHACHHANG_FK] FOREIGN KEY([KHACHHANG])
REFERENCES [dbo].[KHACHHANG] ([ID])
GO
ALTER TABLE [dbo].[HOADON] CHECK CONSTRAINT [HOADON_KHACHHANG_FK]
GO
ALTER TABLE [dbo].[HOADON] WITH CHECK ADD CONSTRAINT [HOADON_NHANVIEN_FK] FOREIGN KEY([NHANVIEN])
REFERENCES [dbo].[NHANVIEN] ([ID])
GO
ALTER TABLE [dbo].[HOADON] CHECK CONSTRAINT [HOADON_NHANVIEN_FK]
GO
ALTER TABLE [dbo].[KHACHHANG] WITH CHECK ADD CONSTRAINT [KHACHHANG_TINH_FK] FOREIGN KEY([TINH])
REFERENCES [dbo].[TINH] ([ID])
GO
ALTER TABLE [dbo].[KHACHHANG] CHECK CONSTRAINT [KHACHHANG_TINH_FK]
GO
ALTER TABLE [dbo].[NHACUNGCAP] WITH CHECK ADD CONSTRAINT [NHACUNGCAP_TINH_FK] FOREIGN KEY([TINH])
REFERENCES [dbo].[TINH] ([ID])
GO
ALTER TABLE [dbo].[NHACUNGCAP] CHECK CONSTRAINT [NHACUNGCAP_TINH_FK]
GO
ALTER TABLE [dbo].[NHANVIEN] WITH CHECK ADD CONSTRAINT [NHANVIEN_CONGVIEC_FK] FOREIGN KEY([CONGVIEC])
REFERENCES [dbo].[CONGVIEC] ([ID])
GO
ALTER TABLE [dbo].[NHANVIEN] CHECK CONSTRAINT [NHANVIEN_CONGVIEC_FK]
GO
ALTER TABLE [dbo].[NHANVIEN] WITH CHECK ADD CONSTRAINT [NHANVIEN_TINH_FK] FOREIGN KEY([TINH])
REFERENCES [dbo].[TINH] ([ID])
GO
ALTER TABLE [dbo].[NHANVIEN] CHECK CONSTRAINT [NHANVIEN_TINH_FK]
GO
ALTER TABLE [dbo].[SANPHAM] WITH CHECK ADD CONSTRAINT [SANPHAM_LOAISANPHAM_FK] FOREIGN KEY([LOAISANPHAM])
REFERENCES [dbo].[LOAISANPHAM] ([ID])
GO
ALTER TABLE [dbo].[SANPHAM] CHECK CONSTRAINT [SANPHAM_LOAISANPHAM_FK]
GO
ALTER TABLE [dbo].[SANPHAM] WITH CHECK ADD CONSTRAINT [SANPHAM_MAU_FK] FOREIGN KEY([MAU])
REFERENCES [dbo].[MAU] ([ID])
GO
ALTER TABLE [dbo].[SANPHAM] CHECK CONSTRAINT [SANPHAM_MAU_FK]
GO
ALTER TABLE [dbo].[SANPHAM] WITH CHECK ADD CONSTRAINT [SANPHAM_NHACUNGCAP_FK] FOREIGN KEY([NHACUNGCAP])
REFERENCES [dbo].[NHACUNGCAP] ([ID])
GO
ALTER TABLE [dbo].[SANPHAM] CHECK CONSTRAINT [SANPHAM_NHACUNGCAP_FK]
GO
ALTER TABLE [dbo].[TINH] WITH CHECK ADD CONSTRAINT [TINH_QUOCGIA_FK] FOREIGN KEY([QUOCGIA])
REFERENCES [dbo].[QUOCGIA] ([ID])
GO
ALTER TABLE [dbo].[TINH] CHECK CONSTRAINT [TINH_QUOCGIA_FK]
GO
ALTER TABLE [dbo].[KHACHHANG] WITH CHECK ADD CONSTRAINT [KHACHHANG_GIOITINH] CHECK (([GIOITINH]=(1) OR [GIOITINH]=(0)))
GO
ALTER TABLE [dbo].[KHACHHANG] CHECK CONSTRAINT [KHACHHANG_GIOITINH]
GO
ALTER TABLE [dbo].[NHANVIEN] WITH CHECK ADD CONSTRAINT [NHANVIEN_GIOITINH] CHECK (([GIOITINH]=(1) OR [GIOITINH]=(0)))
GO
ALTER TABLE [dbo].[NHANVIEN] CHECK CONSTRAINT [NHANVIEN_GIOITINH]
GO
USE [master]
GO
ALTER DATABASE [TECHSHOP] SET READ_WRITE
GO