English

How To: Describe the columns in a RDBMS table

Summary

Though it may seem like a fundamental tool for SQL programmers and DBAs, the method for describing the columns in a RDBMS table from the SQL command line varies from vendor to vendor. This is how some of the major vendors do it.

Procedure

  • Oracle:

    DESCRIBE tablename;

  • Informix:

    INFO COLUMNS FOR tablename;

  • IBM DB2:

    There is no built-in command. Instead, you need to query from the system catalogue for this information.

    SELECT COLNAME,TABSCHEMA,TABNAME FROM SYSCAT.COLUMNS WHERE TABSCHEMA='owner' AND TABNAME='tablename';