简体   繁体   中英

Error 1064 - MySQL Database Creation

So I'm a complete novice with MySQL and I'm trying to follow a tutorial that will allow me to sort out an Ajax + JQuery page for my database.

However, running this code in PHPMyAdmin:

CREATE TABLE IF NOT EXISTS 'add_delete_record' (
  'id' int(11) NOT NULL AUTO_INCREMENT,
  'content' text NOT NULL,
  PRIMARY KEY ('id')
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

produces the error:

SQL query:

CREATE TABLE IF NOT EXISTS 'add_delete_record'(

'id'INT( 11 ) NOT NULL AUTO_INCREMENT , 'content'TEXT NOT NULL , PRIMARY KEY ( 'id' ) ) ENGINE = INNODB DEFAULT CHARSET = latin1 AUTO_INCREMENT =1 MySQL said:

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 ''add_delete_record' ( 'id' int(11) NOT NULL AUTO_INCREMENT,
'content' text' at line 1

Being a novice I have absolutely no clue what is wrong, apart from the fact that there is a problem with the syntax somewhere? Thanks to anyone who can help!

Use backticks instead. Single quotes represent string literals.

CREATE TABLE IF NOT EXISTS `add_delete_record` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `content` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

use backticks

  CREATE TABLE IF NOT EXISTS `add_delete_record` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
   `content` text NOT NULL,
   PRIMARY KEY (`id`)
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM