0

what's wrong with this? I'm new to MySQL/MariaDB.

CREATE TABLE 'keys_table'(
  '_key' CHAR(8) NOT NULL,   
  '_product_id' VARCHAR(100) NOT NULL,   
  '_seller' VARCHAR(50) NOT NULL,   
  '_created_at' timestamp NOT NULL,   
  PRIMARY KEY ( '_key' )
);
ERROR 1064 (42000) at line 2: 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 ''keys_table'('_key_code' CHAR(8),   '_product_id' VARCHAR(100) NOT NULL,   '_sel' at line 1

Thank you :)

2 Answers2

0

Remove all single quotes:

CREATE TABLE keys_table(
  _key CHAR(8) NOT NULL,   
  _product_id VARCHAR(100) NOT NULL,   
  _seller VARCHAR(50) NOT NULL,   
  _created_at timestamp NOT NULL,   
  PRIMARY KEY ( _key )
);
Vladimir Vs
  • 1,242
  • 13
  • 12
0

You shouldn't use quotes (') for the names of the table and columns, you can just do without or you can use backticks if you want (`)

Shix
  • 41
  • 5