CREATE TABLE employee_detail(
e_id int auto_increment,
name varchar(20) not null,
address varchar(20) not null,
status varchar(200) not null,
primary key (e_id),
);
這是我的第一個表(employee_login
),我想E_ID在我的下一個表(login
)以下如何使用外鍵作爲另一個表的主鍵在mysql數據庫中創建表?
CREATE TABLE login(
login_id int auto_increment,
username varchar(20) not null,
password varchar(20) not null,
primary key (login_id),
e_id references employee_detail(e_id)
);
請顯示您的代碼至今 –
您是否嘗試過使用CREATE TABLE語句? –