0

I want to create a table in a database with SQL but a 1064 error appears. Can you help me solve my problem.

CREATE TABLE keys (
`id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`key` varchar(40) NOT NULL,
`level` int(2) NOT NULL,
`ignore_limits` tinyint(1) NOT NULL DEFAULT '0',
`is_private_key` tinyint(1) NOT NULL DEFAULT '0',
`ip_addresses` text,
`date_created` int(11) NOT NULL
 )
SatRac
  • 21
  • 7

1 Answers1

0

key and keys are keywords in mysql. You can solve the problem by changing them.

CREATE TABLE mykeys (
    `id` int(11) NOT NULL,
    `user_id` int(11) NOT NULL,
    `key_value` varchar(40) NOT NULL,
    `level` int(2) NOT NULL,
    `ignore_limits` tinyint(1) NOT NULL DEFAULT '0',
    `is_private_key` tinyint(1) NOT NULL DEFAULT '0',
    `ip_addresses` text,
    `date_created` int(11) NOT NULL
)
Hossein Zare
  • 580
  • 4
  • 17