David,

For the count of columns in a table:

    SELECT count(information_schema.columns.column_name)
    FROM   information_schema.columns
    WHERE  information_schema.columns.table_schema = 'database_name'
    AND    information_schema.columns.table_name = 'table_name'

For the names of the columns in a table:

    SELECT information_schema.columns.column_name
    FROM   information_schema.columns
    WHERE  information_schema.columns.table_schema = 'database_name'
    AND    information_schema.columns.table_name = 'table_name'

Hope this helps.

Randall Price

Microsoft Implementation Group
Secure Enterprise Computing Initiatives
Virginia Tech Information Technology
1700 Pratt Drive
Blacksburg, VA  24060

Email:  [EMAIL PROTECTED]
Phone:  (540) 231-4396

-----Original Message-----
From: davidvaz [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 22, 2006 10:54 AM
To: mysql@lists.mysql.com
Subject: Count Fields of a Table

Hello,

Is there any way to find out, using only plain SQL, the number of fields
of a given table.

describe gives me the number of fields as result, but I need to get only
that.

Is it possible?

Is it also possible to get only the fields name?

Thanks

David


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to