Portable SQL/Statements/Access metadata/Table columns
From Linuxnetworks
Contents
ANSI
SQL-92 defines a collection of objects in INFORMATION_SCHEMA which contains the list of available fields for the tables:
SELECT column_name FROM information_schema.columns WHERE table_name = name
Firebird/Interbase
SELECT RDB$FIELD_NAME FROM RDB$RELATION_FIELDS WHERE RDB$RELATION_NAME = name
MS SQL Server
Fully compatible with SQL-92.
MySQL
Fully compatible with SQL-92.
Oracle
SELECT column_name FROM user_tab_columns WHERE table_name = name ORDER BY column_id
PostgreSQL
Fully compatible with SQL-92.
SQLite
Doesn't support retrieving the name of table fields via a SQL statement.
Sybase ASE
Unknown.