title: Getting syntax error when declaring FOREIGN KEYS in MYSQL (using innoDB)
body: <p>I have the following tables:</p>
  
  <blockquote>
    <p>CREATE TABLE IF NOT EXISTS <code>books</code> (</p>
    
    <p><code>book_id</code> varchar(50) NOT NULL,</p>
    
    <p><code>book_title</code> varchar(50) NOT NULL, </p>
    
    <p><code>courseid</code> varchar(50) NOT NULL,   </p>
    
    <p><strong>FOREIGN KEY ('courseid') REFERENCES 'course'('course_id') ON DELETE CASCADE</strong> </p>
    
    <p>) ENGINE=InnoDB DEFAULT CHARSET=latin1;</p>
    
    <p>CREATE TABLE IF NOT EXISTS <code>course</code> (</p>
    
    <p><code>course_id</code> varchar(50) NOT NULL,</p>
    
    <p><code>year</code> varchar(50) NOT NULL,</p>
    
    <p><code>section</code> varchar(50) NOT NULL,</p>
    
    <p>PRIMARY KEY (<code>course_id</code>)</p>
    
    <p>) ENGINE=InnoDB  DEFAULT CHARSET=latin1;</p>
  </blockquote>
  
  <p>I want to make courseid(under books table) a foreign key referencing course_id (under course table) but getting the following error message:</p>
  
  <p>**#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 ''courseid')
      REFERENCES 'course'('course_id')</p>
  
  <p>) ENGINE=InnoDB DEFAULT CHARS' at line 15** </p>
  
  <p>I tired several syntax for declaring Foreign key (using CONSTRAINT FOREIGN KEY, with/without quotes etc) but none worked.  </p>
  
  <p>I am using Xamp WITH Server version: 5.5.32 - MySQL Community Server (GPL).</p>
  
  <p>Can someone please help me with this issue?</p>
  
  <p>Thanks</p>