Code:
USE master
GO
IF  EXISTS (
	SELECT name 
		FROM sys.databases 
		WHERE name = N'QLBH'
)
DROP DATABASE QLBH
GO

CREATE DATABASE QLBH
GO

USE QLBH
GO

CREATE TABLE Khach
(
makh	NVARCHAR(10)	NOT NULL CONSTRAINT pk_khach PRIMARY KEY,
ten	NVARCHAR(50) NOT NULL ,
diachi NVARCHAR(100) NOT NULL,
dienthoai	NVARCHAR(15) NULL
)		
GO
CREATE TABLE Hang
(
mahang NVARCHAR(10) NOT NULL CONSTRAINT pk_Hang PRIMARY KEY,
tenhang	NVARCHAR(50) NOT NULL,
mota NVARCHAR(100) NULL,
tgbh DATETIME NOT NULL,
slco INT NOT NULL,
nsx NVARCHAR(50) NULL,	
)			
GO
CREATE TABLE Hd
(
sohd NVARCHAR(10) NOT NULL CONSTRAINT pk_Hd PRIMARY KEY,
ngay DATETIME NOT NULL ,
makh NVARCHAR(10) NOT NULL ,
manv NVARCHAR(10) NOT NULL
)			
GO
CREATE TABLE Nhanvien
(
manv NVARCHAR(10) NOT NULL CONSTRAINT pk_Nhanvien PRIMARY KEY, 
tennv NVARCHAR(50) NOT NULL ,
diachinv NVARCHAR(100) NOT NULL,
dtnv NVARCHAR(15) NULL
)
GO

CREATE TABLE Phieu
(
sopc NVARCHAR(10) NOT NULL CONSTRAINT pk_Phieu PRIMARY KEY,
ngay DATETIME NOT NULL,
sohd NVARCHAR(10) NOT NULL,
manv NVARCHAR(10) NOT NULL
)
GO
CREATE TABLE Hangban
(
mahang NVARCHAR(10) NOT NULL ,
sohd NVARCHAR(10) NOT NULL,
slban INT NOT NULL,
gia FLOAT NOT NULL
CONSTRAINT pk_Hangban PRIMARY KEY(mahang,sohd)
)
GO
ALTER TABLE	Hd
ADD
CONSTRAINT fk_Hd_Khach FOREIGN KEY(makh) REFERENCES Khach(makh) 
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT fk_Hd_Nhanvien FOREIGN KEY(manv) REFERENCES Nhanvien(manv) 
ON DELETE CASCADE
ON UPDATE CASCADE
GO

ALTER TABLE Phieu
ADD
CONSTRAINT fk_Phieu_Hd FOREIGN KEY (sohd) REFERENCES Hd(sohd)
ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT fk_Phieu_Nhanvien FOREIGN KEY (manv) REFERENCES Nhanvien(manv)
ON DELETE CASCADE ON UPDATE CASCADE
GO
Mọi người ơi xem hộ mình cái lỗi này với. CSDL tạo như thế này đã được chưa vậy