Heim  >  Fragen und Antworten  >  Hauptteil

MYSQL hat beim Erstellen einer neuen Tabelle den Syntaxfehler 1064 (42000) festgestellt

Ich bin neu bei MYSQL und arbeite mit vielen, vielen Tabellen und wenn ich versuche, die Tabelle zu erstellen, erhalte ich die folgende Fehlermeldung...

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 'rank INTEGER,
  year INTEGER,
  description TEXT,
  PRIMARY KEY(position_id),
  ' at line 4

Anruf erstellen ist

CREATE TABLE Position (
  position_id INTEGER NOT NULL AUTO_INCREMENT,
  profile_id INTEGER,
  rank INTEGER,
  year INTEGER,
  description TEXT,
  PRIMARY KEY(position_id),
  CONSTRAINT position_ibfk_1
    FOREIGN KEY (profile_id)
    REFERENCES Profile (profile_id)
    ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Alles sieht sauber aus, daher bin ich mir nicht sicher, warum ich diese Fehlermeldung erhalte

P粉982054449P粉982054449211 Tage vor457

Antworte allen(1)Ich werde antworten

  • P粉937769356

    P粉9377693562024-03-22 11:07:47

    根据 P.Salmon 的说法,这是因为等级的名称。查看 dev.mysql.com/doc/refman/8.0/en/keywords.html 后,将排名更改为 rank 并且成功了。

    Antwort
    0
  • StornierenAntwort