LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-12-2009, 12:11 AM   #1
jason.rohde
Member
 
Registered: Aug 2005
Location: Chicago
Distribution: RHEL5,CENTOS
Posts: 62

Rep: Reputation: 15
Exclamation MySQL Error when cerating FK in tables, can't pinpoint the syntax error


Can't single the cause of the error and it is driving me insane, can anyone provide any insight?

mysql> CREATE TABLE Shipment (
-> Shipment_ID INT(10) NOT NULL,
-> Delivery_ID INT(10) NOT NULL,
-> Customer_ID INT(10) NOT NULL,
-> Driver_Employee_ID INT(10) NOT NULL,
-> Consignee VARCHAR(255) NOT NULL,
-> Payment_Method VARCHAR(255) NOT NULL,
-> Payment_Received VARCHAR(1) NOT NULL,
-> CONSTRAINT PRIMARY KEY (`Shipment_ID`)
-> FOREIGN KEY (`Delivery_ID`) REFERENCES `Delivery`(`Delivery_ID`)
-> FOREIGN KEY (`Customer_ID`) REFERENCES `Customer`(`Customer_ID`)
-> FOREIGN KEY (`Driver_Employee_ID`) REFERENCES `Driver`(`Driver_Employee_ID`)
-> )ENGINE=InnoDB DEFAULT CHARSET=latin1;
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 'FOREIGN KEY (`Delivery_ID`) REFERENCES `Delivery`(`Delivery_ID`)
FOREIGN KEY (`C' at line 10


Thanks in advance
 
Old 12-12-2009, 12:18 AM   #2
jason.rohde
Member
 
Registered: Aug 2005
Location: Chicago
Distribution: RHEL5,CENTOS
Posts: 62

Original Poster
Rep: Reputation: 15
Version is 5.0.77
 
Old 12-13-2009, 12:24 AM   #3
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,797

Rep: Reputation: 282Reputation: 282Reputation: 282
Not sure but ain't you missing a comma at the end of the end of the line with CONSTRAINT?
 
Old 12-13-2009, 10:46 AM   #4
jason.rohde
Member
 
Registered: Aug 2005
Location: Chicago
Distribution: RHEL5,CENTOS
Posts: 62

Original Poster
Rep: Reputation: 15
That was it, it usually is something little like a comma, thanks for putting your eyes on it.
 
Old 12-14-2009, 12:50 AM   #5
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,797

Rep: Reputation: 282Reputation: 282Reputation: 282
I know the feeling

Can you please mark your thread as solved using the thread tools just above the first post.

WimS
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
perl dbi:mysql shows error syntax error dbi:mysql ?? haxpak Linux - Server 4 02-27-2009 12:09 AM
php / MySQL: You have an error in your SQL syntax error FirstBorn Programming 6 12-31-2008 06:46 PM
MySQL Syntax Error? taylor_venable Programming 2 06-10-2007 09:39 AM
fatal error : can not open privilege tables mysql.host jayakrishnan Linux - Software 3 10-11-2005 09:49 AM
Can't get pass this mysql syntax error Neruocomp Programming 5 07-24-2005 06:25 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration