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
What version of Mysql? Why do you need to inform
visible
there?– Woss
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.
– Marcos De Barros Azevedo
Maria DB 10.2 is based on Mysql 5.7(KB of Mariadb versions) and therefore does not support the keywords
VISIBLE
andINVISIBLE
to define the visibility of the indices. Just take theVISIBLE
that works. The problem is always that generating SQL the Workbench will always put the visibility attribute and you will have to remove manually.– Augusto Vasques
Thank you now it worked!
– Marcos De Barros Azevedo