簡體   English   中英

更改忽略表中的 MySQL 5.6.20 錯誤

[英]MySQL 5.6.20 error in alter ignore table

我添加這一行以將ignore添加到 MySql 數據庫:

ALTER IGNORE cms_books_author name ADD UNIQUE(name)

但我收到此錯誤:

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 版本為: 5.6.20

我該如何解決這個錯誤? 謝謝你。

語法問題

  1. 更改忽略缺少 table 關鍵字
  2. 語法應僅包含唯一索引中的名稱,而不應包含在表名之后

調整

ALTER IGNORE table cms_books_author ADD UNIQUE(name);

sqlfiddle


更改表語法

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