0

created this with my sql and unsure what is wrong with the script

CREATE TABLE IF NOT EXISTS `restaurant`.`restaurant` (
  `_id` INT NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(255) NOT NULL,
  `added_date` VARCHAR(30) NULL,
  `tele_number` VARCHAR(8) NULL,
  `about` TEXT(1024) NULL,
  `average_rating` INT NULL,
  `price` VARCHAR(10) NULL,
  `opening_hour` VARCHAR(255) NULL,
  `restaurantcol` VARCHAR(45) NULL,
  PRIMARY KEY (`_id`),
  UNIQUE INDEX `_id_UNIQUE` (`_id` ASC) VISIBLE,
  UNIQUE INDEX `tele number_UNIQUE` (`tele_number` ASC) VISIBLE)
ENGINE = InnoDB

error given: Error Code: 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 ' UNIQUE INDEX tele number_UNIQUE (tele_number ASC) VISIBLE) ENGINE = InnoD' at line 12

Shadow
  • 33,525
  • 10
  • 51
  • 64
  • 1
    The error messages of MySQL contain the part of the query that has not been parsed because the last parsed token is the one that produces the error. This means the word before *" UNIQUE INDEX tele number_UNIQUE ..."* is the problem. That word is `VISIBLE`. This keyword has been introduced in MySQL 8.0 and you probably use an earlier version. – axiac Dec 29 '19 at 10:03

1 Answers1

1

The error messages of MySQL contain the part of the query that has not been parsed because the last parsed token is the one that produces the error. This means the word before " UNIQUE INDEX tele number_UNIQUE ..." is the problem. That word is VISIBLE.

The VISIBLE keyword has been introduced in MySQL 8.0 and you probably use an earlier version.

By default, the indexes are VISIBLE. You can safely drop this keyword from the query. On MySQL 8 you will get the same result as when you use it. On MySQL 5 the concept of invisible indexes does not exist, all indexes are visible.

I see now in the error message that you are not using MySQL but MariaDB. MariaDB is a fork of MySQL 5 that is compatible with MySQL up to some point. You will find many small differences here and there.

axiac
  • 68,258
  • 9
  • 99
  • 134