Hi David
If you are using mysql 5.0 and up, you can select from the
INFORMATION_SCHEMA database to get this information and much more.
Following is an example using a database called test and a table
called t
To get the column names, use
SELECT column_name FROM information_schema.columns
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'
ANDinformation_schema.columns.table_name = 'table_name'
For the names of the
[...]
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?
AFIK there's no easy way to accomplish this using
Hello,
@Mr. Price and Mr. Sims
Thank you for show me the way, your tips where very educational.
Thanks again.
--
Iván Alemán ~ [[ Debian (Sid) ]] ~
-BEGIN GEEK CODE BLOCK-
Version: 3.12
G!GCM d+ s: a? C+++ UL++ P L$ E--- W+++ N* o--- K- w O- M+ V--
PS++ PE-- Y PGP+++ t-- 5 X R+ !tv