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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
12-12-2009, 12:11 AM
|
#1
|
Member
Registered: Aug 2005
Location: Chicago
Distribution: RHEL5,CENTOS
Posts: 62
Rep:
|
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
|
|
|
12-12-2009, 12:18 AM
|
#2
|
Member
Registered: Aug 2005
Location: Chicago
Distribution: RHEL5,CENTOS
Posts: 62
Original Poster
Rep:
|
Version is 5.0.77
|
|
|
12-13-2009, 12:24 AM
|
#3
|
Senior Member
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,797
|
Not sure but ain't you missing a comma at the end of the end of the line with CONSTRAINT?
|
|
|
12-13-2009, 10:46 AM
|
#4
|
Member
Registered: Aug 2005
Location: Chicago
Distribution: RHEL5,CENTOS
Posts: 62
Original Poster
Rep:
|
That was it, it usually is something little like a comma, thanks for putting your eyes on it.
|
|
|
12-14-2009, 12:50 AM
|
#5
|
Senior Member
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,797
|
I know the feeling
Can you please mark your thread as solved using the thread tools just above the first post.
WimS
|
|
|
All times are GMT -5. The time now is 03:27 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|