MySQL Forums
Forum List  »  MySQL Workbench

Vague, ambiguous error trying to create simple table
Posted by: Menoo Trogdor
Date: August 06, 2019 04:46PM

I'm coming from an MS Access background. I'm trying to do pretty basic stuff with MySQL so that I can create a PHP frontend. However, I can't seem to even create a table using MySQL Workbench. When I try to create a table using the GUI, it creates its own SQL, but then provides a very confusing error that I cannot decipher. Here's the SQL and the result. I'm having a hard time believing that there would be an error in the SQL created by MySQL Workbench. Shouldn't I just be able to click and apply the self-generated SQL?

-SQL created by MySQL Workbench-----------------
CREATE TABLE `dbcars`.`tblvehicles` (
`idcar` INT GENERATED ALWAYS AS () VIRTUAL,
`make` VARCHAR(45) NULL,
`model` VARCHAR(45) NULL,
`year` INT NULL,
`purchaseprice` DECIMAL(14,5) NULL,
`color` VARCHAR(20) NULL,
`oiltype` VARCHAR(10) NULL,
`VIN` VARCHAR(20) NULL,
PRIMARY KEY (`idcar`),
UNIQUE INDEX `idcar_UNIQUE` (`idcar` ASC) VISIBLE);

-Result------------------------------------

Operation failed: There was an error while applying the SQL script to the database.
Executing:
CREATE TABLE `dbcars`.`tblvehicles` (
`idcar` INT GENERATED ALWAYS AS () VIRTUAL,
`make` VARCHAR(45) NULL,
`model` VARCHAR(45) NULL,
`year` INT NULL,
`purchaseprice` DECIMAL(14,5) NULL,
`color` VARCHAR(20) NULL,
`oiltype` VARCHAR(10) NULL,
`VIN` VARCHAR(20) NULL,
PRIMARY KEY (`idcar`),
UNIQUE INDEX `idcar_UNIQUE` (`idcar` ASC) VISIBLE);

ERROR 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 ') VIRTUAL,
`make` VARCHAR(45) NULL,
`model` VARCHAR(45) NULL,
`year` INT N' at line 2
SQL Statement:
CREATE TABLE `dbcars`.`tblvehicles` (
`idcar` INT GENERATED ALWAYS AS () VIRTUAL,
`make` VARCHAR(45) NULL,
`model` VARCHAR(45) NULL,
`year` INT NULL,
`purchaseprice` DECIMAL(14,5) NULL,
`color` VARCHAR(20) NULL,
`oiltype` VARCHAR(10) NULL,
`VIN` VARCHAR(20) NULL,
PRIMARY KEY (`idcar`),
UNIQUE INDEX `idcar_UNIQUE` (`idcar` ASC) VISIBLE)

Options: ReplyQuote


Subject
Views
Written By
Posted
Vague, ambiguous error trying to create simple table
801
August 06, 2019 04:46PM


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.