Below I have two queries. They both should do the same thing but the foreign
key syntax is a little different. The first query fails, though some queries
with foreign key clauses work sometimes, and the second one just works.

Am I right in thinking the syntax for both these queries mean the same
thing?

create table vpn_company_t (
  vpn_company_key integer not null auto_increment,
  vpn_key integer not null,
  company_key integer not null,
  realm_key integer not null,
  vpn_id char(24) not null,
  foreign key(company_key) references company_t,
  foreign key(realm_key) references realm_t,
  foreign key(vpn_key)   references vpn_t,
  primary key (vpn_company_key),
  unique vpn_company_rcv_i (realm_key, company_key, vpn_key)
) 
type = innodb;
ERROR 1005: Can't create table './coredb/vpn_company_t.frm' (errno: 150)


create table vpn_company_t (
  vpn_company_key integer not null auto_increment,
  vpn_key integer not null references vpn_t,
  company_key integer not null references company_t,
  realm_key integer not null references realm_t,
  vpn_id char(24) not null,
  primary key (vpn_company_key),
  unique vpn_company_rcv_i (realm_key, company_key, vpn_key)
)
type = innodb;

WORKS OK


---------------------------------------------------------------------
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