This is a quickie.
I'm pretty new to SQL, and MySQL.
I'm currently learning at Google Code University's Introduction to Databases and MySQL (http://code.google.com/edu/tools101/mysql.html).
I'm following the tutorial via MySQL console, and I keep getting a syntax error when i type this:
create table orders (order_no int not null auto_increment, FK_cust_no int not null,
foreign key(FK_cust_no) references customer(cust_no), primary key(order_no));
Thanks in advance!
I was able to execute your query successfully on MySQL 5.1.
What version of MySQL are you using? And what's the error that you're getting?
Does the table "customers" exist and do the two columns "cust_no" have the exact same data type? If the datatypes differ you can't create a foreign key constrain on the two tables.