MySQL Forums
Forum List  »  PHP

Re: System tables
Posted by: Jay Pipes
Date: June 23, 2005 01:50PM

Before MySQL 5.0.2+, you can use the SHOW FULL COLUMNS command:

USE db_name;
SHOW FULL COLUMNS FROM table_name;

Look for the Field and Type columns in the output.

Now, with MySQL 5.0.2+, you can use the INFORMATION_SCHEMA.COLUMNS table in a much more normalized and standardized method:

SELECT
COLUMN_NAME
, DATA_TYPE
, CHARACTER_MAXIMUM_LENGTH
, NUMERIC_PRECISION
, NUMERIC_SCALE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'db_name'
AND TABLE_NAME = 'table_name';

Jay Pipes
Community Relations Manager, North America, MySQL Inc.

Got Cluster? http://www.mysql.com/cluster
Personal: http://jpipes.com

Options: ReplyQuote


Subject
Written By
Posted
June 23, 2005 12:43PM
Re: System tables
June 23, 2005 01:50PM


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.