简体   繁体   English

更改忽略表中的 MySQL 5.6.20 错误

[英]MySQL 5.6.20 error in alter ignore table

I add this line for add ignore to MySql database :我添加这一行以将ignore添加到 MySql 数据库:

ALTER IGNORE cms_books_author name ADD UNIQUE(name)

but I get this error:但我收到此错误:

Error
SQL query:


ALTER IGNORE cms_books_author name ADD UNIQUE(name)
MySQL said: Documentation

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'efcms_books_author name ADD UNIQUE(name)' at line 1 

Mysql version is : 5.6.20 Mysql 版本为: 5.6.20

how do I fix this error?我该如何解决这个错误? Thank you.谢谢你。

syntax issues语法问题

  1. alter ignore missing the table keyword更改忽略缺少 table 关键字
  2. syntax should only include the name within the unique index not after the tablename语法应仅包含唯一索引中的名称,而不应包含在表名之后

adjusted调整

ALTER IGNORE table cms_books_author ADD UNIQUE(name);

sqlfiddle sqlfiddle


alter table syntax 更改表语法

ALTER [ONLINE | OFFLINE] [IGNORE] TABLE tbl_name [alter_specification [, alter_specification] ...] [partition_options] ... alter_specification: table_options | ADD [CONSTRAINT [symbol]] UNIQUE [INDEX|KEY] [index_name] [index_type] (index_col_name,...) [index_option] ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM