Error while creating tables in mysql

Asked

Viewed 95 times

1

I am trying to create these tables by mysql but it is giving error. I created the relationship between the tables in Mysql Workbench. Can someone give me a hand?

ERROR:

Static analysis:

1 errors were found during analysis.

A comma or a closing bracket was expected. (near "VISIBLE" at position 572)

SQL command:

CREATE TABLE IF NOT EXISTS `webimoveis`.`tb_cadastro_cliente` ( `id` INT NOT NULL AUTO_INCREMENT, `nome` VARCHAR(55) NOT NULL, `sobrenome` VARCHAR(45) NOT NULL, `cnpj` VARCHAR(55) NOT NULL, `razao social` VARCHAR(255) NOT NULL, `rua` VARCHAR(255) NOT NULL, `complemento` VARCHAR(45) NOT NULL, `bairro` VARCHAR(45) NOT NULL, `cidade` VARCHAR(45) NOT NULL, `estado` VARCHAR(45) NOT NULL, `logo_cliente` BLOB NOT NULL, `id_cad` INT NOT NULL, PRIMARY KEY (`id`, `id_cad`), INDEX `fk_tb_cadastro_cliente_tb_imoveis_idx` (`id_cad` ASC) VISIBLE) ENGINE = MyISAM

Mysql Messages : Documentation

#1064 - Você tem um erro de sintaxe no seu SQL próximo a 'VISIBLE)
  ENGINE = MyISAM' na linha 15

Code:

    CREATE TABLE IF NOT EXISTS `webimoveis`.`tb_cadastro_cliente` (
      `id` INT NOT NULL AUTO_INCREMENT,
      `nome` VARCHAR(55) NOT NULL,
      `sobrenome` VARCHAR(45) NOT NULL,
      `cnpj` VARCHAR(55) NOT NULL,
      `razao social` VARCHAR(255) NOT NULL,
      `rua` VARCHAR(255) NOT NULL,
      `complemento` VARCHAR(45) NOT NULL,
      `bairro` VARCHAR(45) NOT NULL,
      `cidade` VARCHAR(45) NOT NULL,
      `estado` VARCHAR(45) NOT NULL,
      `logo_cliente` BLOB NOT NULL,
      `id_cad` INT NOT NULL,
      PRIMARY KEY (`id`, `id_cad`),
      INDEX `fk_tb_cadastro_cliente_tb_imoveis_idx` (`id_cad` ASC) VISIBLE)
      ENGINE = MyISAM;

    CREATE TABLE IF NOT EXISTS `webimoveis`.`tb_imoveis` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `titulo_imovel` VARCHAR(255) NOT NULL,
  `numero` VARCHAR(45) NOT NULL,
  `bairro` VARCHAR(45) NOT NULL,
  `cidade` VARCHAR(45) NOT NULL,
  `estado` VARCHAR(45) NOT NULL,
  `area_util` INT NOT NULL,
  `area_total` INT NOT NULL,
  `n_quartos` INT NOT NULL,
  `n_banheiros` INT NOT NULL,
  `n_vagas` INT NOT NULL,
  `descricao` LONGTEXT NOT NULL,
  `valor` FLOAT(10,2) NOT NULL,
  `status` INT NULL,
  `tipo` VARCHAR(45) NULL,
  PRIMARY KEY (`id`))
ENGINE = MyISAM
  • 1

    What version of Mysql? Why do you need to inform visible there?

  • The version is 5.7.14, I created the relationship by SQL Workbench gave a copy to Clipboard and played in mysql direct. It already came from Workbench with Visible.

  • 1

    Maria DB 10.2 is based on Mysql 5.7(KB of Mariadb versions) and therefore does not support the keywords VISIBLE and INVISIBLE to define the visibility of the indices. Just take the VISIBLE that works. The problem is always that generating SQL the Workbench will always put the visibility attribute and you will have to remove manually.

  • Thank you now it worked!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.