List:General Discussion« Previous MessageNext Message »
From:Peter Brawley Date:January 13 2005 12:32am
Subject:Re: Getting info about db columns
View as plain text  
SHOW TABLES lists tables in a db

DESCRIBE tablename (= SHOW CREATE TABLE tablename) outputs column info, 
but your application will have to parse it.

EXPLAIN is for query optimisation analysis, not table column listings.

The manual's pretty clear on these topics.



Dave Merrill wrote:

>Hi, mysql newb here, coming mostly from ms sql server.
>I'm wondering how to find out basic info (type, str length, column name if
>getting all cols from a list of tables, etc), about a set of columns from a
>number of different tables. I'm also interested in getting a list of the
>tables in a db.
>SQL Server has a pair of views (information_schema.tables and
>information_schema.columns) that were useful for this kind of thing. Since
>they're normal views, you can restrict the tables or cols found by table,
>column, type, etc, and retrieve only the info you want about them; anything
>that works in a std query works here.
>The only way I know of to get this kind of metadata from mysql is explain,
>which appears to only return a fixed set of info about all the columns in a
>single table. Is there any way to get:
>- A list of tables in a db
>- Column info for more than one table at once
>- Only certain info about these cols (name and type only, say)
>Dave Merrill

Getting info about db columnsDave Merrill12 Jan
  • Re: Getting info about db columnsSGreen12 Jan
  • Re: Getting info about db columnsRhino12 Jan
  • Re: Getting info about db columnsPeter Brawley13 Jan
RE: Getting info about db columnsDave Merrill13 Jan