SQL无法创建表

时间:2019-11-17 22:40:21

标签: mysql sql

我已经创建了剩余的表格,但是它没有停止,我寻求帮助

CREATE TABLE IF NOT EXISTS `cun`.`factura` (
  `id_factura` INT(11) NOT NULL,
  `id_cliente` INT(11) NULL DEFAULT NULL,
  `id_tipodepago` INT(11) NULL DEFAULT NULL,
  `id_envio` INT(11) NULL DEFAULT NULL,
  `fecha` DATE NULL DEFAULT NULL,
  `hora` TIME NULL DEFAULT NULL,
  PRIMARY KEY (`id_factura`),
  INDEX `fk_formadepago_idx` (`id_tipodepago` ASC),
  INDEX `fk_clientes_idx` (`id_cliente` ASC),
  INDEX `fk_envio_idx` (`id_envio` ASC),
  CONSTRAINT `fk_formadepago`
    FOREIGN KEY (`id_tipodepago`)
    REFERENCES `cun`.`formadepago` (`id_tipodepago`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_detallefactura`
    FOREIGN KEY (`id_factura`)
    REFERENCES `cun`.`detalle_factura` (`id_factura`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_clientes`
    FOREIGN KEY (`id_cliente`)
    REFERENCES `cun`.`clientes` (`id_cliente`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_envio`
    FOREIGN KEY (`id_envio`)
    REFERENCES `cun`.`envio` (`id_envio`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;

0 个答案:

没有答案