You are here: [ot] listing foreign keys in mySQL on InnoDB « PHP Programming Language « IT news, forums, messages
[ot] listing foreign keys in mySQL on InnoDB

Posted by Erwin Moller on 01/24/07 11:35

Hi Group,

Coming from Postgres, still learning mysql, so be gentle. :)
[I posted this question in alt.comp.database.mysql but that group doesn't
seem to be very active, and I am in a hurry, so forgive me for asking
here.]

I use mysql 5 with innodb engine.
When I create a table like:
create table tbltest(
testid int(10) UNSIGNED NOT NULL auto_increment,
artid int(10) UNSIGNED NOT NULL REFERENCES tblart.artid,
PRIMARY KEY (testid)
) ENGINE=InnoDB;

Works fine.
If I insert a value in artid that doesn't exist in tblart, mysql produces an
error as it should do.

Now if I want to find out about the tablestructure, like this:
SHOW CREATE TABLE tbltest;
mysql just shows the create table syntax, BUT without the FK-constraint.

When looking through the documentation I only found SHOW TRIGGERS, but that
also doesn't list the FKs.

I must be missing something completely in the docs. :-/
How can I ask mysql which Foriegn Keys it has?

TIA

Regards,
Erwin Moller

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация