Erro ao criar tabela: você tem um erro na sintaxe SQL próximo a 'order (order_id INT UNSIGNED NÃO NULL AUTO_INCREMENT, user_id' na linha 1 [duplicado]

Esta questão já tem uma resposta aqui:

Erro de sintaxe devido ao uso de uma palavra reservada como um nome de tabela ou coluna no MySQL 1 resposta

Eu estou tentando criar 2 tabelas no mesmo banco de dados MySQL com um script PHP: tabela 'usuário' com chave primária 'user_id' e tabela 'ordem' com chave primária 'order_id' e chave estrangeira 'user_id' do 'usuário' tabela (1 para muitos relacionamento).

Usuário da tabela cria com sucesso sem problemas:

$sql="CREATE TABLE user(
    user_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
    type ENUM('member','admin') NOT NULL,
    username VARCHAR(30) NOT NULL,
    email VARCHAR(80) NOT NULL,
    pass VARBINARY(32) NOT NULL,
    first_name VARCHAR(40) NOT NULL,
    last_name VARCHAR(40) NOT NULL,
    date_expires DATE NOT NULL,
    date_created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    date_modified TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
    PRIMARY KEY (user_id),
    UNIQUE (username),
    UNIQUE (email) 
    )ENGINE=InnoDB DEFAULT CHARSET=utf8";

No entanto, não consigo criar uma ordem de tabela:

$sql="CREATE TABLE order(
    order_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
    user_id INT UNSIGNED NOT NULL,
    transaction_id VARCHAR(19) NOT NULL,
    payment_status VARCHAR(15) NOT NULL,
    payment_amount DECIMAL(6,2) UNSIGNED NOT NULL,
    payment_date_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (order_id),
    FOREIGN KEY (user_id) REFERENCES user (user_id)
    )ENGINE=InnoDB DEFAULT CHARSET=utf8";

Estou tendo o erro a seguir:

Error creating table: 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 'order( order_id INT UNSIGNED NOT NULL AUTO_INCREMENT, user_id ' at line 1

Já verifiquei a sintaxe e não consigo encontrar o erro. Você poderia, por favor, informar o que deu errado? Muito obrigado.

questionAnswers(2)

yourAnswerToTheQuestion