Is it possible to receive only the structure of the table even if its empty and put the field names in an array. If so which SQL command make开发者_运维百科s that possible.
If you are using MySQL 5.0 or later, you can get the field names from the INFORMATION_SCHEMA.COLUMNS
table.
Something like
SELECT COLUMN_NAME
FROM COLUMNS
WHERE TABLE_NAME = <table_name>
Here is a link to a list of tables in the INFORMATION_SCHEMA database.
In Oracle and MySQL, this SQL query will give you the details of the table, including columns and column types:
describe table_name
This may or may not work in other databases.
thanks for the link the awnser is for example table 'vraag'
SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'vraag'
精彩评论