Executing SQL script in server
ERROR: 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 ')
ENGINE = InnoDB' at line 5
-- -----------------------------------------------------
-- Table `mydb`.`dvd_collection`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`dvd_collection` (
)
ENGINE = InnoDB
SQL script execution finished: statements: 5 succeeded, 1 failed
I'm guessing maybe it does not like creating a table with no columns?
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
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='TRADITIONAL,ALLOW_INVALID_DATES';
CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
USE `mydb` ;
-- -----------------------------------------------------
-- Table `mydb`.`dvd_collection`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`dvd_collection` (
)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`movies`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`movies` (
`movie_id` INT NOT NULL AUTO_INCREMENT ,
`title` DATE NOT NULL ,
`release_date` DATE NULL ,
PRIMARY KEY (`movie_id`) )
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
I just tested it locally, and it worked fine once I added one column to the definition:
Code:
CREATE TABLE IF NOT EXISTS `mydb`.`dvd_collection` (
`foo` INT(9)
)
ENGINE = InnoDB;
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
It's saying, in it's rather simpleton-like way, that its parser encountered a closing ")" at a point were it did not expect to find one (i.e., not until after at least one column has been specified).
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks