[英]unable to create a table in mysql
I have created a database registration in MySQL that already has 2 tables users and employees. 我已经在MySQL中创建了一个数据库注册,该数据库注册已经有2个表的用户和雇员。 I want to create a third table Leave
but it is showing error 1064. I have tried everything. 我想创建第三个表Leave
但显示错误1064。我已经尝试了所有方法。 Please guide me what is going wrong. 请指导我出了什么问题。
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
);
Please change table name as per below query it will work. 请按照以下查询更改表名,它将起作用。
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
);
As leave is keyword in mysql used to exit any labeled flow control construct so you can not used keyword as table name. 由于离开是mysql中用于退出任何带标签的流控制结构的关键字,因此不能将关键字用作表名。
I tested your code and a found "leave" is a reserved word in sql, so you can change "leave" with "leave_table" 我测试了您的代码,发现“ 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.