-1

I am writing an mysql program (using the command line editor):

CREATE TABLE FLIGHTS (
FL_NO  VARCHAR(10) NOT NULL PRIMARY KEY,
STARTING VARCHAR(20) NOT NULL,
ENDING VARCHAR(20) NOT NULL,
NO_FLIGTHS INT NOT NULL,
NO_STOPS INT NOT NULL
);

this is somehow gives an error which is surprising. any idea?

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 'STARTING VARCHAR(20) NOT NULL, ENDING VARCHAR(20) NOT NULL, NO_FLIGHTS INTEGER N' at line 3

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149

1 Answers1

-1

STARTING and ENDING are keywords, and MySql does not accept keywords as column names, changing them should help...

  • This is not entirely true. – Shadow Feb 10 '22 at 15:07
  • MySql does not accept RESERVED as column names, -Reserved words are permitted as identifiers if you quote them as described in Section 9.2, “Schema Object Names”: https://dev.mysql.com/doc/refman/8.0/en/keywords.html#keywords-8-0-detailed-S – P.Salmon Feb 10 '22 at 15:08