MySQL Forums
Forum List  »  Newbie

How to query MySQL to get a table definition (column defs, constraint defs (pk, fk, uni...))
Posted by: tourneur
Date: August 19, 2004 03:48AM

Hi!

I've got some troubles finding a way to query the server about a ~complete~ table definition (full-typed column definitions with column contraints, table constraint definitions (primary keys, foreign keys, unique and so on), indexes...) on MySQL on-line doc.

Is there a way to get this information simply (or not simply if not possible)?

In the case I wasn't clear: for example, a (very) nice query would be:

``mysql> PLEASE PRINT FULL DEFINITION OF TABLE myTable;''

and a (very very) nice result would be:

myTable
--------------
id int(11) NOT NULL PRIMARY KEY,
fk int(11) NOT NULL,
u0 int(11) NOT NULL,
u1 int(11) NOT NULL,
CONSTRAINT myFk FOREIGN KEY fk REFERENCES foreignTable(fk),
CONSTRAINT myUnique UNIQUE (u0, u1)

Thanks for any answer.

T.Tourneur

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.