'Foreign key 'FK_NhanVien.....' references invalid table 'PhongBan". Why invalid?
Foreign key 'FK_NhanVien.....' references invalid table 'PhongBan". Why is it invalid?
create table NhanVien(
MaNV varchar(9) not null primary key foreign key references NhanVien(MaNV),
HoNV nvarchar(15) not null,
TenLot nvarchar(15) not null,
TenNV nvarchar(15) not null,
NgaySinh date not null,
DiaChi nvarchar(50) not null,
GioiTinh nvarchar(3) not null,
Luong real not null,
Ma_NQL char(9),
Phong int not null foreign key references PhongBan(MaPhong)
)
create table PhongBan(
MaPhong int primary key,
TenPhong char(15) not null,
TruongPhong varchar(9) not null foreign key references NhanVien(MaNV),
Ngay_NhanChuc date
)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
