www.webdeveloper.com
Results 1 to 6 of 6

Thread: [RESOLVED] sql error

  1. #1
    Join Date
    Apr 2012
    Posts
    110

    resolved [RESOLVED] sql error

    I am getting this error in MySQL Workbench:

    Code:
    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
    What is wrong with the sql?

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,312
    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

    eBookworm.us

  3. #3
    Join Date
    Apr 2012
    Posts
    110
    here is the full sql:

    Code:
    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;
    the tutorial that i'm following:

    http://docs.oracle.com/cd/E17952_01/...rkbench-en.pdf

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,312
    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

    eBookworm.us

  5. #5
    Join Date
    Apr 2012
    Posts
    110
    so what is it exactly saying is wrong with ')?

  6. #6
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,312
    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

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles