title: How to debug the MySQL error "#1064 - You have an error in your SQL syntax"
body: <p>I understand that this question has been asked multiple times but I am huge beginner, I am transferring the database from SQL workbench to phpmyadmin. I keep getting this error:</p>
  
  <p>SQL query:    </p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `ApplicationSystem`.`staff` (
    `StaffID` TEXT(6) NOT NULL,
    `Name` VARCHAR(45) NULL,
    `Email` VARCHAR(254) NULL,
    `Password` VARCHAR(45) NULL,
    PRIMARY KEY (`StaffID`),
    CONSTRAINT `StaffID`
      FOREIGN KEY ()
      REFERENCES `ApplicationSystem`.`UserType` ()
      ON DELETE NO ACTION
      ON UPDATE NO ACTION)
  ENGINE = InnoDB
  MySQL said: Documentation
  
  #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 ')
      REFERENCES `ApplicationSystem`.`UserType` ()
      ON DELETE NO ACTION
    ' at line 8
  </code></pre>
  
  <p>here is the actual SQL code: </p>
  
  <pre><code>-- MySQL Script generated by MySQL Workbench
  -- 04/04/16 23:56:12
  -- Model: New Model    Version: 1.0
  -- MySQL Workbench Forward Engineering
  
  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';
  
  -- -----------------------------------------------------
  -- Schema ApplicationSystem
  -- -----------------------------------------------------
  
  -- -----------------------------------------------------
  -- Schema ApplicationSystem
  -- -----------------------------------------------------
  CREATE SCHEMA IF NOT EXISTS `ApplicationSystem` DEFAULT CHARACTER SET utf8 ;
  USE `ApplicationSystem` ;
  
  -- -----------------------------------------------------
  -- Table `ApplicationSystem`.`staff`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `ApplicationSystem`.`staff` (
    `StaffID` TEXT(6) NOT NULL,
    `Name` VARCHAR(45) NULL,
    `Email` VARCHAR(254) NULL,
    `Password` VARCHAR(45) NULL,
    PRIMARY KEY (`StaffID`),
    CONSTRAINT `StaffID`
      FOREIGN KEY ()
      REFERENCES `ApplicationSystem`.`UserType` ()
      ON DELETE NO ACTION
      ON UPDATE NO ACTION)
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `ApplicationSystem`.`UserType`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `ApplicationSystem`.`UserType` (
    `Type` ENUM('A', 'HA', 'AT') NULL,
    `ID` TEXT(6) NOT NULL,
    INDEX `ID_idx` (`ID` ASC),
    PRIMARY KEY (`ID`),
    UNIQUE INDEX `ID_UNIQUE` (`ID` ASC),
    CONSTRAINT `ID`
      FOREIGN KEY (`ID`)
      REFERENCES `ApplicationSystem`.`Applicants` (`ApplicantID`)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION,
    CONSTRAINT `ID`
      FOREIGN KEY (`ID`)
      REFERENCES `ApplicationSystem`.`staff` (`StaffID`)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION)
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `ApplicationSystem`.`Applicants`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `ApplicationSystem`.`Applicants` (
    `ApplicantID` TEXT(6) NULL,
    `Firstname` VARCHAR(40) NULL,
    `surname` VARCHAR(40) NULL,
    `DOB` DATE NULL,
    `Gender` ENUM('yes', 'no') NULL,
    `Address` VARCHAR(45) NULL,
    `Postcode` VARCHAR(9) NULL,
    `ApplicantMobile` TEXT(11) NULL,
    `ApplicantHome` TEXT(11) NULL,
    `ApplicantEmail` VARCHAR(255) NULL,
    `ParentName` VARCHAR(40) NULL,
    `Relationtoapplicant` VARCHAR(15) NULL,
    `ParentEmail` VARCHAR(255) NULL,
    `ParentAddress` VARCHAR(40) NULL,
    `ParentPostcode` VARCHAR(9) NULL,
    `ParentHome` TEXT(11) NULL,
    `ParentMobile` TEXT(11) NULL,
    `Currentschool` VARCHAR(40) NULL,
    `ApplicantInYr11` ENUM('yes', 'no') NULL,
    `Sibbling` ENUM('yes', 'no') NULL,
    `SibblingName` VARCHAR(40) NULL,
    `SibblingYear` TEXT(2) NULL,
    `MedicalConditions` VARCHAR(30) NULL,
    `AccessArrangementsAvailable` ENUM('yes', 'no') NULL,
    `AccessArrangments` VARCHAR(20) NULL,
    `Ethnic` VARCHAR(40) NULL,
    `FirstLanguage` VARCHAR(15) NULL,
    `HomeLanguage` VARCHAR(15) NULL,
    `Religion` VARCHAR(15) NULL,
    `Nationality` VARCHAR(20) NULL,
    `ArmedForces` ENUM('yes', 'no') NULL,
    `PreviouslyLookedAfter` ENUM('yes', 'no') NULL,
    `EUResident` ENUM('yes', 'no') NULL,
    `RestrictionResidence` ENUM('yes', 'no') NULL,
    `school1` VARCHAR(45) NULL,
    `school2` VARCHAR(45) NULL,
    `school3` VARCHAR(45) NULL,
    `school4` VARCHAR(45) NULL,
    `UPN` TEXT(13) NULL,
    `UCL` TEXT(13) NULL,
    `ULN` TEXT(10) NULL,
    `Password` VARCHAR(40) NULL,
    `Course1` VARCHAR(30) NULL,
    `Course2` VARCHAR(30) NULL,
    `Course3` VARCHAR(30) NULL,
    `Course4` VARCHAR(30) NULL,
    `Course5` VARCHAR(30) NULL,
    `Complete` TINYINT(1) NULL,
    `Outcome` ENUM('R', 'A') NULL,
    PRIMARY KEY (`ApplicantID`),
    UNIQUE INDEX `idtable1_UNIQUE` (`ApplicantID` ASC),
    UNIQUE INDEX `ApplicantEmail_UNIQUE` (`ApplicantEmail` ASC),
    CONSTRAINT `ApplicantID`
      FOREIGN KEY ()
      REFERENCES `ApplicationSystem`.`UserType` ()
      ON DELETE NO ACTION
      ON UPDATE NO ACTION)
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `ApplicationSystem`.`table1`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `ApplicationSystem`.`table1` (
    `ID` TEXT(6) NOT NULL,
    `outcome` TEXT(6) NULL,
    PRIMARY KEY (`ID`))
  ENGINE = InnoDB;
  
  
  -- -----------------------------------------------------
  -- Table `ApplicationSystem`.`outcome`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `ApplicationSystem`.`outcome` (
    `ID` TEXT(6) NOT NULL,
    `Outcome` ENUM('R', 'A') NULL,
    PRIMARY KEY (`ID`),
    CONSTRAINT `ID`
      FOREIGN KEY (`ID`)
      REFERENCES `ApplicationSystem`.`Applicants` (`ApplicantID`)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION)
  ENGINE = InnoDB;
  
  USE `ApplicationSystem` ;
  
  -- -----------------------------------------------------
  -- Placeholder table for view `ApplicationSystem`.`view1`
  -- -----------------------------------------------------
  CREATE TABLE IF NOT EXISTS `ApplicationSystem`.`view1` (`id` INT);
  
  -- -----------------------------------------------------
  -- View `ApplicationSystem`.`view1`
  -- -----------------------------------------------------
  DROP TABLE IF EXISTS `ApplicationSystem`.`view1`;
  USE `ApplicationSystem`;
  
  
  SET SQL_MODE=@OLD_SQL_MODE;
  SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
  SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS
  </code></pre>