TrọngTrường (2331540262)
TrọngTrường (2331540262)
TrọngTrường (2331540262)
NgayTao Datetime,
PhiVanchuyen money,
DonHang int
ALTER TABLE HoaDon ADD CONSTRAINT FK_HD_DH FOREIGN KEY (DonHang) REFERENCES DonHang
(SoDH)
Ngaysinh Datetime,
DiaChi nvarchar(100),
SoDienThoai char(10),
LoaiKH int,
Email nvarchar(150),
MaNV int
ALTER TABLE KhachHang ADD CONSTRAINT FK_KH_NV FOREIGN KEY (MaNV) REFERENCES Nhanvien
(MaNV)
MaMH varchar(15),
SoHD int
ALTER TABLE ChiTietDH ADD CONSTRAINT FK_ChiTietDH_HD FOREIGN KEY (SoDH) REFERENCES
HoaDon (SoHD)
Ngay datetime,
Trangthai varchar(20),
NVPhuTrach int
ALTER TABLE TTDonHang ADD CONSTRAINT FK_TTDH_DH FOREIGN KEY (SoDH) REFERENCES DonHang
(SoDH)
ALTER TABLE TTDonHang ADD CONSTRAINT FK_TTDH_NV FOREIGN KEY (NVPhuTrach) REFERENCES
Nhanvien (MaNV)
NgayThamGia Datetime,
ALTER TABLE TaikhoanKH ADD CONSTRAINT TKKH FOREIGN KEY (MaKH) REFERENCES KhachHang (MaKH)
CREATE TABLE PhongBan
NgayTao Datetime
ChucVu nvarchar(50),
NgaySinh Date,
ALTER TABLE NhanVien ADD CONSTRAINT FK_MAPB_NV FOREIGN KEY (MaPB) REFERENCES PhongBan
(MaPB)
LoaiThanhToan int,
NgayTao Datetime,
DCGiaoHang nvarchar,
HinhThucVanChuyen int,
SoLuong int
ALTER TABLE DonHang ADD CONSTRAINT FK_DH_KH FOREIGN KEY (KhachHang) REFERENCES KhachHang
(MaKH)
GiaBan money,
GiaMua money,
NhaSX varchar(150)
)
ALTER TABLE MatHang ADD CONSTRAINT FK_MH_LH FOREIGN KEY (MaLoai) REFERENCES LoaiHang
(MaLoai)