Page 1 of 1

How can I see relantionship in database.

Posted: Mon Oct 20, 2008 2:36 pm
by tua1
Hello!

Is there a SQL command to show relationship between tables in selected database?

Something like DESCRIBE.


Regards

Re: How can I see relantionship in database.

Posted: Mon Oct 20, 2008 3:01 pm
by califdon
tua1 wrote:Hello!

Is there a SQL command to show relationship between tables in selected database?

Something like DESCRIBE.

Regards
What database engine are you using? As far as I know, MySQL database engines do not store relationships, they are only established in SQL queries.

Re: How can I see relantionship in database.

Posted: Mon Oct 20, 2008 3:09 pm
by VladSun
califdon wrote:As far as I know, MySQL database engines do not store relationships, they are only established in SQL queries.
MySQL InnoDB does.

http://dev.mysql.com/doc/refman/5.0/en/ ... aints.html

If it is MySQL (InnoDB) you could use:
[sql]SHOW CREATE TABLE tbl_name;[/sql]

Re: How can I see relantionship in database.

Posted: Mon Oct 20, 2008 3:39 pm
by califdon
VladSun wrote:
califdon wrote:As far as I know, MySQL database engines do not store relationships, they are only established in SQL queries.
MySQL InnoDB does.

http://dev.mysql.com/doc/refman/5.0/en/ ... aints.html

If it is MySQL (InnoDB) you could use:
[sql]SHOW CREATE TABLE tbl_name;[/sql]
Thanks, Vlad. I was thinking that maybe it did, but was too lazy to look it up. I stick with MyISAM because I haven't needed the features of InnoDB.

Re: How can I see relantionship in database.

Posted: Mon Oct 20, 2008 3:49 pm
by onion2k
More people should use MySQL Workbench. It's actually really good these days. Even the free version.

Re: How can I see relantionship in database.

Posted: Tue Oct 21, 2008 4:36 am
by tua1
thanks for the replys.