List:General Discussion« Previous MessageNext Message »
From:SGreen Date:January 12 2005 9:16pm
Subject:Re: Getting info about db columns
View as plain text  
May I introduce you to the family of SHOW commands? 
SHOW DATABASES - lists all databases on a server
SHOW TABLES - lists all tables within your current database
SHOW CREATE TABLE xxxxx - returns a table containing a SQL statement you 
could use to recreate the table xxxxx if you needed to (including all 
indexes and constraints)
SHOW COLUMNS FROM xxxxx - returns a table similar to 
INFORMATION_SCHEMA.columns but only for the table you specify.

and the list goes on and on:

Alas, the INFORMATION_SCHEMA views are not production ready. They are 
being added to MySQL with the  5.x+ branch of development, which is not 
yet stable. Be patient, many good things are coming with v5.

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

"Dave Merrill" <dmerrill@stripped> wrote on 01/12/2005 04:07:16 PM:

> Hi, mysql newb here, coming mostly from ms sql server.
> I'm wondering how to find out basic info (type, str length, column name 
> 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. 
> they're normal views, you can restrict the tables or cols found by 
> column, type, etc, and retrieve only the info you want about them; 
> that works in a std query works here.
> The only way I know of to get this kind of metadata from mysql is 
> 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)
> Thanks,
> Dave Merrill
> -- 
> MySQL General Mailing List
> For list archives:
> To unsubscribe:

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