I am using MySql-3.23.51.  Even though this version
doesn't support foreign keys, the foreign key
declarations can be entered without getting an error
message.  I would like to write CREATE TABLE
statements that include foreign key declarations that
would be compatible with future releases that will
support them.  The goal is to write the SQL once,
without the need to change it later on.

Would the following statements be correct in the
current version of MySql as well as version 4.1?

create table orders (
  orderID int not null auto_increment,
  date  date not null,
  amount  double(6,2),
  primary key(orderID) );

create table orderItems (
  orderID  int not null,
  quantity smallint not null,
  partNo   int not null,
  key(orderID),
  foreign key(orderID) references orders(orderID) );

  


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to