0

Hi I am currently getting this error:

java.sql.SQLSyntaxErrorException: 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 'Signal (SignalName VARCHAR(50) PRIMARY KEY, hasMeasure VARCHAR(50), FOREIGN KEY ' at line 1

Here is the query:

CREATE TABLE Signal (
    SignalName VARCHAR(50) PRIMARY KEY, 
    hasMeasure VARCHAR(50), FOREIGN KEY (hasMeasure) REFERENCES Measure(MeasureName), 
    hasRecording VARCHAR(50), FOREIGN KEY (hasRecording) REFERENCES Recording(RecordingName), 
    hasObservableInformation VARCHAR(50), FOREIGN KEY (hasObservableInformation) REFERENCES ObservableInformation(ObservableInformationName)
)

It's weird because all similar queries are working... For example this:

CREATE TABLE Recording (
    RecordingName VARCHAR(50) PRIMARY KEY, 
    hasRegisteredChannel VARCHAR(50), FOREIGN KEY (hasRegisteredChannel) REFERENCES RegisteredChannel(RegisteredChannelName), 
    hasParticipation VARCHAR(50), FOREIGN KEY (hasParticipation) REFERENCES Participation(ParticipationName)
)

I am using MySQL version 8.0.25.

Thanks for help

Roe
  • 11
  • 3
    `SIGNAL` is a MySQL reserved word: https://dev.mysql.com/doc/refman/8.0/en/keywords.html. Call the table something else (say `SIGNALS`). – Gordon Linoff Jun 20 '21 at 12:43

0 Answers0