MySQL Forums
Forum List  »  MySQL Workbench

Re: Error Code: 1146 when creating new table desc
Posted by: Peter Brawley
Date: June 26, 2022 03:02PM

Three syntax errors ...

1 VISIBLE in the unique index

MySQL doesn't seem to like VISIBLE or INVISIBLE in CREATE TABLE, I'm unsure why. For creating an invisible index, this works ...

create table x( ..., unique index key_f(f), ...);

But in your case, VISIBLE is the default so it's not needed.

2 Missing semicolon at the end of the Create Table stmt

3 In the Insert stmt, SELECT instead of a left parenthesis at the beginning of the column list

In general, the soundest way to write an error-free script is to compose each stmt in a text editor, test it in the mysql command client or you if you prefer mysqlsh or workbench, add it to the script once it's debugged.

Even better, if the script might be run without supervision by an experienced MySQL developer, assemble the debugged code in a stored procedure with DECLARE EXIT HANDLER and SIGNAL commands for error handling.

Edited 1 time(s). Last edit at 06/26/2022 03:03PM by Peter Brawley.

Options: ReplyQuote

Written By
Re: Error Code: 1146 when creating new table desc
June 26, 2022 03:02PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.