How can I see relantionship in database.

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
tua1
Forum Commoner
Posts: 28
Joined: Thu May 15, 2008 9:30 pm

How can I see relantionship in database.

Post by tua1 »

Hello!

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

Something like DESCRIBE.


Regards
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: How can I see relantionship in database.

Post 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.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: How can I see relantionship in database.

Post 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]
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: How can I see relantionship in database.

Post 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.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: How can I see relantionship in database.

Post by onion2k »

More people should use MySQL Workbench. It's actually really good these days. Even the free version.
tua1
Forum Commoner
Posts: 28
Joined: Thu May 15, 2008 9:30 pm

Re: How can I see relantionship in database.

Post by tua1 »

thanks for the replys.
Post Reply