0

Here is my table schema:

CREATE TABLE invoice_item
(
    _id                    BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
    invoice_id             BIGINT,
    item                   CHAR(11) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
    # One of:
    #   - 'D': Default
    #   - 'M': Meta
    type                   CHAR(1) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
    order                  INT NOT NULL,
    status                 CHAR(1) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
    INDEX (invoice_id, item, status, order)
);

And I got this error message

ERROR 1064 (42000): 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 INT NOT NULL,

I am using mysql 8 on AWS RDS.

I am not sure if it is because 'order' is a reserved keyword.

I have replaced 'order' with 'rank' (to avoid using a keyword) but mysql still throws a syntax error at the same spot.

What is exactly the syntax error there?

Anthony Kong
  • 37,791
  • 46
  • 172
  • 304

0 Answers0