Home > Blockchain >  There's an error in my syntax, I don't know where
There's an error in my syntax, I don't know where

Time:09-09

mysql> CREATE TABLE customer_status(
    status_id INT NOT NULL AUTO_INCREMENT,
    name VARCHAR (50) NOT NULL,
    rank INT NOT NULL,
    PRIMARY KEY(status_id))
    ENGINE=innodb
    CHARSET=latin1
    COLLATE=latin1_general_ci;

SEEMS THAT I CAN'T USE THE WORD RANK

CodePudding user response:

RANK is a reserved word in MySQL. You can escape it with the backtick (`) character.

CREATE TABLE customer_status(
status_id INT NOT NULL AUTO_INCREMENT,
name VARCHAR (50) NOT NULL,
`rank` INT NOT NULL,
PRIMARY KEY(status_id))
ENGINE=innodb
CHARSET=latin1
COLLATE=latin1_general_ci;
  • Related