Teju Halakattí
Teju Halakattí

Reputation: 15

Error in SQL syntax manual that corresponds to your MySQL server version

 Create table Enroll(usn varchar(10),
                     course_id varchar(10),
                     attendance int(10),
                     marks int(10,2),
                     foreign key(usn) references bmsStudent(usn),
                     foreign key(course_id) references Course(course_id)
                    );

Error1064(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 ',2),.... ' at line 1

Help me resolve error in my SQL query

Upvotes: 0

Views: 609

Answers (2)

Ankit Bajpai
Ankit Bajpai

Reputation: 13509

If you strictly need decimals in marks column, Use Decimal instead -

marks DECIMAL(10, 2),

Upvotes: 1

Hogan
Hogan

Reputation: 70523

when you can't have two parameters in an int.

change

   marks int(10,2),

to

   marks int

note: this should be easy to figure out for you -- the error message tells you the part of the query ",2)" and there is only one place where that occurs in your input so you know exactly where the error is without asking us.

Upvotes: 1

Related Questions