2

Me sale este error al importar el sql al phpmyadmin. He mirado varios posts y he visto que si quito VISIBLE pues debería de funcionar y nada. No se aun programar sql por tanto no entiendo muy bien el error. Os dejo el error a continuacion:

ERROR 1064 (42000) at line 121: 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 2

Operation failed with exitcode 1

Os dejo aqui el codigo que se me ha generado:

-- MySQL Script generated by MySQL Workbench
-- Thu Jan 28 19:57:32 2021
-- Model: New Model    Version: 1.0
-- MySQL Workbench Forward Engineering

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION";

-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------

-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET utf8 ;
USE `mydb` ;

-- -----------------------------------------------------
-- Table `mydb`.`concierto`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`concierto` (
  `id` INT NOT NULL,
  `fecha` DATETIME NULL,
  `duracion` TIME NULL,
  `temporada` VARCHAR(10) NULL,
  `titulo` VARCHAR(45) NULL,
  PRIMARY KEY (`id`))
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mydb`.`interprete`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`interprete` (
  `id` INT NOT NULL,
  `nombre` VARCHAR(45) NULL,
  `curriculum` VARCHAR(1000) NULL,
  `tipo` INT NOT NULL,
  PRIMARY KEY (`id`))
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mydb`.`pieza`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`pieza` (
  `id` INT NOT NULL,
  `titulo` VARCHAR(45) NULL,
  `autor` VARCHAR(100) NULL,
  PRIMARY KEY (`id`))
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mydb`.`grupo`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`grupo` (
  `formacion` VARCHAR(20) NULL,
  `interprete_id` INT NOT NULL,
  INDEX `fk_grupo_interprete1_idx` (`interprete_id` ASC),
  PRIMARY KEY (`interprete_id`),
  CONSTRAINT `fk_grupo_interprete1`
    FOREIGN KEY (`interprete_id`)
    REFERENCES `mydb`.`interprete` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mydb`.`individual`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`individual` (
  `instrumento` VARCHAR(20) NULL,
  `interprete_id` INT NOT NULL,
  INDEX `fk_individual_interprete1_idx` (`interprete_id` ASC),
  PRIMARY KEY (`interprete_id`),
  CONSTRAINT `fk_individual_interprete1`
    FOREIGN KEY (`interprete_id`)
    REFERENCES `mydb`.`interprete` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mydb`.`orquesta`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`orquesta` (
  `num_musico` INT NULL,
  `director` VARCHAR(45) NULL,
  `interprete_id` INT NOT NULL,
  INDEX `fk_orquesta_interprete1_idx` (`interprete_id` ASC),
  PRIMARY KEY (`interprete_id`),
  CONSTRAINT `fk_orquesta_interprete1`
    FOREIGN KEY (`interprete_id`)
    REFERENCES `mydb`.`interprete` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mydb`.`entradas`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`entradas` (
  `fila` INT NOT NULL,
  `asiento` INT NOT NULL,
  `fecha` DATETIME NULL,
  `hora` TIME NULL,
  `precio` INT NULL,
  PRIMARY KEY (`fila`, `asiento`))
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mydb`.`table8`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`table8` (
)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mydb`.`tocar`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`tocar` (
  `pieza_id` INT NOT NULL,
  `interprete_id` INT NOT NULL,
  PRIMARY KEY (`pieza_id`, `interprete_id`),
  INDEX `fk_pieza_has_interprete_interprete1_idx` (`interprete_id` ASC),
  INDEX `fk_pieza_has_interprete_pieza1_idx` (`pieza_id` ASC),
  CONSTRAINT `fk_pieza_has_interprete_pieza1`
    FOREIGN KEY (`pieza_id`)
    REFERENCES `mydb`.`pieza` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_pieza_has_interprete_interprete1`
    FOREIGN KEY (`interprete_id`)
    REFERENCES `mydb`.`interprete` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mydb`.`vender`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`vender` (
  `entradas_fila` INT NOT NULL,
  `entradas_asiento` INT NOT NULL,
  `concierto_id` INT NOT NULL,
  PRIMARY KEY (`entradas_fila`, `entradas_asiento`, `concierto_id`),
  INDEX `fk_entradas_has_concierto_concierto1_idx` (`concierto_id` ASC),
  INDEX `fk_entradas_has_concierto_entradas1_idx` (`entradas_fila` ASC, `entradas_asiento` ASC),
  CONSTRAINT `fk_entradas_has_concierto_entradas1`
    FOREIGN KEY (`entradas_fila` , `entradas_asiento`)
    REFERENCES `mydb`.`entradas` (`fila` , `asiento`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_entradas_has_concierto_concierto1`
    FOREIGN KEY (`concierto_id`)
    REFERENCES `mydb`.`concierto` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mydb`.`tocar`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`tocar` (
  `pieza_id` INT NOT NULL,
  `interprete_id` INT NOT NULL,
  PRIMARY KEY (`pieza_id`, `interprete_id`),
  INDEX `fk_pieza_has_interprete_interprete1_idx` (`interprete_id` ASC),
  INDEX `fk_pieza_has_interprete_pieza1_idx` (`pieza_id` ASC),
  CONSTRAINT `fk_pieza_has_interprete_pieza1`
    FOREIGN KEY (`pieza_id`)
    REFERENCES `mydb`.`pieza` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_pieza_has_interprete_interprete1`
    FOREIGN KEY (`interprete_id`)
    REFERENCES `mydb`.`interprete` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mydb`.`participar`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`participar` (
  `individual_interprete_id` INT NOT NULL,
  `grupo_interprete_id` INT NOT NULL,
  PRIMARY KEY (`individual_interprete_id`, `grupo_interprete_id`),
  INDEX `fk_individual_has_grupo_grupo1_idx` (`grupo_interprete_id` ASC),
  INDEX `fk_individual_has_grupo_individual1_idx` (`individual_interprete_id` ASC),
  CONSTRAINT `fk_individual_has_grupo_individual1`
    FOREIGN KEY (`individual_interprete_id`)
    REFERENCES `mydb`.`individual` (`interprete_id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_individual_has_grupo_grupo1`
    FOREIGN KEY (`grupo_interprete_id`)
    REFERENCES `mydb`.`grupo` (`interprete_id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mydb`.`participar`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`participar` (
  `individual_interprete_id` INT NOT NULL,
  `grupo_interprete_id` INT NOT NULL,
  PRIMARY KEY (`individual_interprete_id`, `grupo_interprete_id`),
  INDEX `fk_individual_has_grupo_grupo1_idx` (`grupo_interprete_id` ASC),
  INDEX `fk_individual_has_grupo_individual1_idx` (`individual_interprete_id` ASC),
  CONSTRAINT `fk_individual_has_grupo_individual1`
    FOREIGN KEY (`individual_interprete_id`)
    REFERENCES `mydb`.`individual` (`interprete_id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_individual_has_grupo_grupo1`
    FOREIGN KEY (`grupo_interprete_id`)
    REFERENCES `mydb`.`grupo` (`interprete_id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
3
  • Pues eso, tienes un syntax error (error de sintaxis) alrededor del fragmento de código SQL que dice ') ENGINE = InnoDB. Revisa, está mal escrita tu sentencia. Tampoco se entiende cuál era el VISIBLE que quitaste porque no está en el código que compartes.
    – Alfabravo
    el 28 ene. 2021 a las 19:17
  • El problema es que aun no he tocado sql, estoy estudiando modelo relacional y no encuentro el fallo aun.
    – tomas_hm01
    el 28 ene. 2021 a las 19:21
  • Hora de aprender en la práctica :) Así comenzamos todos
    – Alfabravo
    el 28 ene. 2021 a las 19:21

1 respuesta 1

2

Tienes una tabla

-- -----------------------------------------------------
-- Table `mydb`.`table8`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`table8` (
)
ENGINE = InnoDB;

¿No será que esto no va? No te fíes de lo autogenerado y haz debug ejecutando los SQL por secciones para validar cuál falla

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.