Alex Rivera | Logout

What is the SQL command to return the field names of a table?

Asked 2008-09-19T08:33:25.020
42

Say I have a table called myTable. What is the SQL command to return all of the field names of this table? If the answer is database specific then I need SQL Server right now but would be interested in seeing the solution for other database systems as well.

Edit
Report

1 Answer

4

PostgreSQL understands the

select column_name from information_schema.columns where table_name = 'myTable'

syntax. If you're working in the psql shell, you can also use

\d myTable

for a description (columns, and their datatypes and constraints)

answered 2008-09-19T12:33:43.233

Your Answer