Reputation: 8334
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 makes that possible.
Upvotes: 0
Views: 63
Reputation: 8334
thanks for the link the awnser is for example table 'vraag'
SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'vraag'
Upvotes: 0
Reputation: 83250
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.
Upvotes: 2
Reputation: 7098
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.
Upvotes: 0