[英]unable to create a table in mysql
我已經在MySQL中創建了一個數據庫注冊,該數據庫注冊已經有2個表的用戶和雇員。 我想創建第三個表Leave
但顯示錯誤1064。我已經嘗試了所有方法。 請指導我出了什么問題。
create table leave(
employeecode int(11) primary key auto_increment,
description varchar(100) not null,
fromdate date not null,
todate date not null,
status varchar(100) not null
);
請按照以下查詢更改表名,它將起作用。
create table leavetable(
employeecode int(11) primary key auto_increment,
description varchar(100) not null,
fromdate date not null,
todate date not null,
status varchar(100) not null
);
由於離開是mysql中用於退出任何帶標簽的流控制結構的關鍵字,因此不能將關鍵字用作表名。
我測試了您的代碼,發現“ leave”是sql中的保留字,因此您可以使用“ leave_table”更改“ leave”
create table leave_table(
employeecode int(11) primary key auto_increment,
description varchar(100) not null,
fromdate date not null,
todate date not null,
status varchar(100) not null
);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.