Đoạn code của em bị lỗi ngay 2 cái khóa ngoại, ai biết chỉ giùm em. Thank:happy:
create DATABASE CUAHANG*****
CREATE TABLE NHANVIEN
(
MANV CHAR(6) PRIMARY KEY,
TENNV VARCHAR(40),
CMNDNV CHAR(9),
GIOITINH VARCHAR(4),
NAMSINHNV SMALLDATETIME,
DIACHINV VARCHAR(50),
SDTNV VARCHAR(11),
NGAYVL SMALLDATETIME,
MALUONG CHAR(6) FOREIGN KEY REFERENCES LUONG(MALUONG),
)
CREATE TABLE LUONG
(
MALUONG CHAR(6) PRIMARY KEY,
UNGTRUOC MONEY,
MAL1T CHAR(6) FOREIGN KEY REFERENCES LUONG1THANG(MAL1T)
)
CREATE TABLE LUONG1THANG
(
MAL1T CHAR(6) PRIMARY KEY,
NGAYDAUTHANG SMALLDATETIME,
NGAYCUOITHANG SMALLDATETIME,
SONGAYNGHI INT,
TIENLUONG MONEY,
MACSL CHAR(6) FOREIGN KEY REFERENCES CHISOLUONG(MACSL)
)
CREATE TABLE CHISOLUONG
(
MACSL CHAR(6) PRIMARY KEY,
LUONGCOBAN MONEY
)
CREATE TABLE KHACHHANG
(
MAKH CHAR(6) PRIMARY KEY,
TENKH VARCHAR(40),
CMNDKH CHAR(9),
NAMSINHKH SMALLDATETIME,
DIACHIKH VARCHAR(5),
SDTKH VARCHAR(11)
)
:shot::shot::shot::shot::shot:
CREATE TABLE HOADON
(
MAHD CHAR(6) PRIMARY KEY,
NGAYHD SMALLDATETIME,
TONGTIEN MONEY,
MAKH CHAR(6) FOREIGN KEY REFERENCES KHACHHANG(MAKH),
MANV CHAR(6),FOREIGN KEY REFERENCES NHANVIEN(MANV),
)
create DATABASE CUAHANG*****
CREATE TABLE NHANVIEN
(
MANV CHAR(6) PRIMARY KEY,
TENNV VARCHAR(40),
CMNDNV CHAR(9),
GIOITINH VARCHAR(4),
NAMSINHNV SMALLDATETIME,
DIACHINV VARCHAR(50),
SDTNV VARCHAR(11),
NGAYVL SMALLDATETIME,
MALUONG CHAR(6) FOREIGN KEY REFERENCES LUONG(MALUONG),
)
CREATE TABLE LUONG
(
MALUONG CHAR(6) PRIMARY KEY,
UNGTRUOC MONEY,
MAL1T CHAR(6) FOREIGN KEY REFERENCES LUONG1THANG(MAL1T)
)
CREATE TABLE LUONG1THANG
(
MAL1T CHAR(6) PRIMARY KEY,
NGAYDAUTHANG SMALLDATETIME,
NGAYCUOITHANG SMALLDATETIME,
SONGAYNGHI INT,
TIENLUONG MONEY,
MACSL CHAR(6) FOREIGN KEY REFERENCES CHISOLUONG(MACSL)
)
CREATE TABLE CHISOLUONG
(
MACSL CHAR(6) PRIMARY KEY,
LUONGCOBAN MONEY
)
CREATE TABLE KHACHHANG
(
MAKH CHAR(6) PRIMARY KEY,
TENKH VARCHAR(40),
CMNDKH CHAR(9),
NAMSINHKH SMALLDATETIME,
DIACHIKH VARCHAR(5),
SDTKH VARCHAR(11)
)
:shot::shot::shot::shot::shot:
CREATE TABLE HOADON
(
MAHD CHAR(6) PRIMARY KEY,
NGAYHD SMALLDATETIME,
TONGTIEN MONEY,
MAKH CHAR(6) FOREIGN KEY REFERENCES KHACHHANG(MAKH),
MANV CHAR(6),FOREIGN KEY REFERENCES NHANVIEN(MANV),
)
Comment