1
I was trying to create a table in mysql, simple, but it was giving an error. I decided to download an ide (Dbeaver), it kept giving error, so I downloaded Mysql Workbench and it does not generate the table. See the error:
CREATE TABLE `wmp_fut`.`contratos` (
`id_campeonato` INT NOT NULL AUTO_INCREMENT,
`nome_campeonato` VARCHAR(100) NOT NULL,
`negociacoes` ENUM('Aberto', 'Fechado') NOT NULL,
`validade` DATE NOT NULL DEFAULT 2020-01-01,
PRIMARY KEY (`id_campeonato`),
UNIQUE INDEX `nome_campeonato_UNIQUE` (`nome_campeonato` ASC));
Operation failed: There was an error while applying the SQL script to the database.
Executing:
CREATE TABLE `wmp_fut`.`contratos` (
`id_campeonato` INT NOT NULL AUTO_INCREMENT,
`nome_campeonato` VARCHAR(100) NOT NULL,
`negociacoes` ENUM('Aberto', 'Fechado') NOT NULL,
`validade` DATE NOT NULL DEFAULT 2020-01-01,
PRIMARY KEY (`id_campeonato`),
UNIQUE INDEX `nome_campeonato_UNIQUE` (`nome_campeonato` 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 '-01-01,
PRIMARY KEY (`id_campeonato`),
UNIQUE INDEX `nome_campeonato_UNIQUE`' at line 5
SQL Statement:
CREATE TABLE `wmp_fut`.`contratos` (
`id_campeonato` INT NOT NULL AUTO_INCREMENT,
`nome_campeonato` VARCHAR(100) NOT NULL,
`negociacoes` ENUM('Aberto', 'Fechado') NOT NULL,
`validade` DATE NOT NULL DEFAULT 2020-01-01,
PRIMARY KEY (`id_campeonato`),
UNIQUE INDEX `nome_campeonato_UNIQUE` (`nome_campeonato` ASC))
. Can anyone solve it? Mysql and Bds in general are not my language, excuse the stupid question.
Buddy, thank you!
– Wan