Skip to content
Advertisement

Error(1064) (42000) : check the manual that corresponds to your MySQL server version for the right syntax to use near ‘)’ at line 9

My sql table is giving error but I cant find one !

This my sql table :

-- createawardprize 

-- create awardprize table 

--table 5

DROP TABLE IF EXISTS Awardprize;

CREATE TABLE Awardprize(

                awardid CHAR(2) NOT NULL,

                personid CHAR(4) NOT NULL,

                winnername VARCHAR(20) NOT NULL,

                wyear YEAR NOT NULL,

                PRIMARY KEY (awardid, personid),

                FOREIGN KEY(awardid) REFERENCES Award(aid) ON DELETE CASCADE,

                FOREIGN KEY(personid) REFERENCES person(pid) ON DELETE CASCADE,
);      

Error:

mysql> SOURCE /home/q55555b/Documents/Database Systems/Final Assesment_20193113/createawardprize.sql 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 ‘–table 5

DROP TABLE IF EXISTS Awardprize’ at line 1 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 ‘)’ at line 9

Advertisement

Answer

https://dev.mysql.com/doc/refman/8.0/en/ansi-diff-comments.html says:

… the -- start-comment sequence must be followed by a space…

You wrote this:

--table 5

Change it to this:

-- table 5
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement