0

I'm trying to add a table 'users' in a database 'restoratedb'. So, using the following code gives me an error message

CREATE TABLE IF NOT EXISTS `restoratedb`.`users` (
  `user_id` INT NOT NULL AUTO_INCREMENT,
   ...
  PRIMARY KEY (`user_id`),
  UNIQUE INDEX `id_UNIQUE` (`user_id` ASC) VISIBLE)
ENGINE = InnoDB;

I'm getting the bellow error message

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')
ENGINE = InnoDB' at line 14
Bill Karwin
  • 538,548
  • 86
  • 673
  • 828
  • Either you are using an old version of MySQL or there's a syntax problem you are not showing. It works well in the fiddle. See https://www.db-fiddle.com/f/p2wYCW1sVABZLUPKnncJ3t/0 – The Impaler May 28 '22 at 01:01
  • What does `SELECT VERSION();` return? – Bill Karwin May 28 '22 at 01:14
  • @BillKarwin 10.4.24-MariaDB –  May 28 '22 at 01:16
  • It's the keyword [VISIBLE](https://mariadb.com/kb/en/create-table/) which is not known in MariaDB, see: [DBFIDDLE](https://dbfiddle.uk/?rdbms=mariadb_10.4&fiddle=6a0f39105d401207ec1c518f34db284b) – Luuk May 28 '22 at 09:42

0 Answers0