Syntax error sql, # 1064

0

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

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 pretty stupid mistake, but I'm new to this area ...

    
asked by anonymous 11.12.2017 / 01:46

1 answer

1

The error is because you are putting single quotes instead of the accent, the right one 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
    
11.12.2017 / 01:52