MySQL Forums
Forum List  »  Newbie

Cannot create table - cryptic error
Posted by: Menoo Trogdor
Date: December 03, 2018 05:49PM

Hello. I'm a novice user who has mostly used MS Access and VB to create databases. I'm made a jump to Linux and MySQL/PHP to develop some simple tools.

I'm trying to create a simple table using MySQLWorkbench with the following schema:
UID INT Should autonumber
Make VARCHAR(45)
Model VARCHAR(45)
Year VARCHAR(4)

When I "apply" the table to commit it to the DB, I get the "Apply SQL SCript to Database" prompt and it creates the following SQL:

CREATE TABLE `admin64`.`tblcars` (
`UID` INT GENERATED ALWAYS AS () VIRTUAL,
`Make` VARCHAR(45) NULL,
`Model` VARCHAR(45) NULL,
`Year` VARCHAR(4) NULL,
PRIMARY KEY (`UID`),
UNIQUE INDEX `UID_UNIQUE` (`UID` ASC));

Then, when I press "Apply", I get an error that I don't understand...

"Error: There was an error while applying the SQL script to the database."

Message log:
"
Operation failed: There was an error while applying the SQL script to the database.
Executing:
CREATE TABLE `admin64`.`tblcars` (
`UID` INT GENERATED ALWAYS AS () VIRTUAL,
`Make` VARCHAR(45) NULL,
`Model` VARCHAR(45) NULL,
`Year` VARCHAR(4) NULL,
PRIMARY KEY (`UID`),
UNIQUE INDEX `UID_UNIQUE` (`UID` ASC));

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` VARCH' at line 2
SQL Statement:
CREATE TABLE `admin64`.`tblcars` (
`UID` INT GENERATED ALWAYS AS () VIRTUAL,
`Make` VARCHAR(45) NULL,
`Model` VARCHAR(45) NULL,
`Year` VARCHAR(4) NULL,
PRIMARY KEY (`UID`),
UNIQUE INDEX `UID_UNIQUE` (`UID` ASC))
"

Options: ReplyQuote


Subject
Written By
Posted
Cannot create table - cryptic error
December 03, 2018 05:49PM


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.