-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsql.txt
More file actions
25 lines (25 loc) · 801 Bytes
/
sql.txt
File metadata and controls
25 lines (25 loc) · 801 Bytes
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
--Tạo CSDL: QLSanpham
Create DataBase QLSanpham
use QLSanpham
---Tao Table LoaiSP
Create Table LoaiSP
(
Maloai char(2) primary key,
Tenloai nvarchar(20)
)
Insert into LoaiSP values('BK',N'Bánh kẹo')
Insert into LoaiSP values('GK',N'Giải khát')
Insert into LoaiSP values('MP',N'Mỹ phẩm')
----Tạo tabl Sanpham
Create Table Sanpham
(
MaSP char(4) primary key,
TenSP nvarchar(20),
Dongia bigint,
Maloai char(2) foreign key references LoaiSP(Maloai)
)
Insert into Sanpham values('SP01',N'Bánh mì',10000,'BK')
Insert into Sanpham values('SP02',N'Bánh bao',15000,'BK')
Insert into Sanpham values('SP03',N'Coca cola',12000,'GK')
Insert into Sanpham values('SP04',N'Pepsi',11000,'GK')
Insert into Sanpham values('SP05',N'Kem chống nắng',85000,'MP')