Syntax error sql, #1064

Asked

Viewed 9,584 times

2

I’m trying to create a table in my phpmyadmin database.

SQL

CREATE TABLE IF NOT EXISTS 'chat' (
  'id' int(11) NOT NULL AUTO_INCREMENT,
  'time' timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  'username' varchar(32) NOT NULL,
  'text' varchar(128) NOT NULL,
  PRIMARY KEY ('id')
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1

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 ''chat' (
  'id' int(11) NOT NULL AUTO_INCREMENT,
  'time' timestamp NOT NULL D' at line 1 

It must be a very stupid mistake, but as I am new in this area...

1 answer

3


The mistake is because you are putting simple quotes instead of the accent, the right would be:

CREATE TABLE IF NOT EXISTS `chat` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `username` varchar(32) NOT NULL,
  `text` varchar(128) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.