1

using mySQL version 5.0.51a-24+lenny4. What is wrong with the following script? I keep getting the following error:

ERROR 1064 (42000): 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 'mjla_creat.sql' at line 1

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';


-- -----------------------------------------------------
-- Table `mjla_db`.`ClassTable`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `mjla_db`.`ClassTable` (
  `classId` VARCHAR(20) NOT NULL COMMENT 'This columns is used to store the class identifier.' ,
  `className` VARCHAR(10) NOT NULL COMMENT 'Holds the name of the class. for example.' ,
  `classSection` VARCHAR(5) NOT NULL COMMENT 'Holds the section label. Used to designate which section the class is.' ,
  `classSemester` VARCHAR(2) NOT NULL COMMENT 'This is used to designate which semester. This is given two character positions incase a school needed to determine which semester within the semester.' ,
  `classYear` VARCHAR(4) NOT NULL COMMENT 'This is for the year of the class.' ,
  `teacherId` VARCHAR(20) NOT NULL ,
  PRIMARY KEY (`classId`) ,
  UNIQUE INDEX `classId_UNIQUE` (`classId` ASC) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mjla_db`.`TeacherTable`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `mjla_db`.`TeacherTable` (
  `teacherId` VARCHAR(20) NOT NULL COMMENT 'This is the teacher id. This table will have to be pre-populated by the administrator with teacher id\'s and their passwords.' ,
  `teacherPassword` VARCHAR(32) NOT NULL COMMENT 'Stores the password as md5.' ,
  PRIMARY KEY (`teacherId`) ,
  UNIQUE INDEX `teacherId_UNIQUE` (`teacherId` ASC) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mjla_db`.`QuizTable`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `mjla_db`.`QuizTable` (
  `classId` VARCHAR(20) NOT NULL COMMENT 'FK related to the ClassTable. This way each Class in the ClassTable is associated with its quiz in the QuizTable.' ,
  `quizId` INT NOT NULL AUTO_INCREMENT COMMENT 'This is the quiz number associated with the quiz.' ,
  `quizObject` BLOB NOT NULL COMMENT 'This is the actual quiz object.' ,
  `quizEnabled` TINYINT(1)  NOT NULL ,
  PRIMARY KEY (`classId`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mjla_db`.`StudentTable`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `mjla_db`.`StudentTable` (
  `studentId` VARCHAR(20) NOT NULL ,
  `lastName` VARCHAR(45) NOT NULL ,
  `firstName` VARCHAR(45) NOT NULL ,
  `studentPassword` VARCHAR(32) NOT NULL ,
  PRIMARY KEY (`studentId`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mjla_db`.`StudentRecordTable`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `mjla_db`.`StudentRecordTable` (
  `classId` VARCHAR(20) NOT NULL ,
  `studentId` VARCHAR(20) NOT NULL ,
  `quizGrade` TINYINT NULL ,
  `quizId` INT NOT NULL AUTO_INCREMENT ,
  PRIMARY KEY (`classId`) )
ENGINE = InnoDB;



SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

Thanks!

2
  • Could it be that you are calling mysql with the wrong parameter? mjla_creat.sql instead of mjla_create.sql ? Commented Oct 8, 2011 at 16:22
  • hard to say, there is nothing wrong at line 1, did you try to start MySQL interactively and feed those queries one by one? Commented Oct 8, 2011 at 16:25

1 Answer 1

1

near 'mjla_creat.sql' at line 1

This string does not occur in the SQL script you show, so the error is not in your SQL script. It's probably an error from the command you're using to invoke the script.

You can invoke from a shell prompt (you may also need other options to connect to the database):

$ mysql mjla < mjla_creat.sql 

Or you can invoke it from the MySQL monitor:

mysql> \. mjla_creat.sql

Or

mysql> source mjla_creat.sql
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.