locked
Error 1064: You have an error in your SQL syntax help!! RRS feed

  • Question

  • Hello. I am getting an Error which i do not understand, here is the error and the code:

    ERROR: Error 1064: 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 '
      CONSTRAINT `fk_cylinders_equipment`
        FOREIGN KEY (`equipment_equipment_id`' at line 13

    SQL Code:

     -- -----------------------------------------------------
            -- Table `QUBQML_CS`.`cylinders`
            -- -----------------------------------------------------
            CREATE TABLE IF NOT EXISTS `QUBQML_CS`.`cylinders` (
              `cylinder_id` INT NOT NULL AUTO_INCREMENT,
              `make` INT NOT NULL,
              `serialNo` VARCHAR(30) NOT NULL,
              `thread` VARCHAR(10) NOT NULL,
              `manufactureDate` DATETIME NOT NULL,
              `usage` INT NOT NULL,
              `equipment_equipment_id` INT NOT NULL,
              PRIMARY KEY (`cylinder_id`, `equipment_equipment_id`),
              INDEX `fk_cylinders_equipment_idx` (`equipment_equipment_id` ASC) VISIBLE,
              CONSTRAINT `fk_cylinders_equipment`
                FOREIGN KEY (`equipment_equipment_id`)
                REFERENCES `QUBQML_CS`.`equipment` (`equipment_id`)
                ON DELETE NO ACTION
                ON UPDATE NO ACTION)
            ENGINE = InnoDB
    

    I do not understand what is wrong as im new to SQL and databaces. Your help is much appreciated!

    Sunday, August 12, 2018 4:32 PM

Answers

All replies