You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by Apache Wiki <wi...@apache.org> on 2006/07/07 19:12:28 UTC

[Db-derby Wiki] Update of "ListTableColumns" by jeanTanderson

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Db-derby Wiki" for change notification.

The following page has been changed by jeanTanderson:
http://wiki.apache.org/db-derby/ListTableColumns

The comment on the change is:
Adding new page about displaying column info for a table

New page:
This page lists various ways to output information about the columns in a table.

== Using ij ==

If all you want is to output the column names, the query below executed in {{{ij}}} shows how to do that for a table named ''my_table'':

{{{
ij> select * from my_table where 1=2;
}}}

You can obtain more details by querying the system catalogs. The query below outputs information about
the columns in the {{{SYS.SYSCONSTRAINTS}}} table:

{{{
select columnnumber, columnname, columndatatype
    from sys.systables t, sys.syscolumns, sys.sysschemas s
    where tableid=referenceid and t.schemaid=s.schemaid
      and schemaname='SYS' and tablename='SYSCONSTRAINTS'
    order by columnnumber;
}}}


[http://issues.apache.org/jira/browse/DERBY-1164 DERBY-1164] is an enhancement request to add {{{show tables}}} and {{{describe}}} commands to {{{ij}}}.

== Using dblook ==

The {{{dblook}}} utility lets you extract the schema for a database or a table in that database.  {{{dblook}}} is documented in the [http://db.apache.org/derby/docs/10.1/tools/ctoolsdblook.html ''Derby Tools and Utilities Guide''], which also provides handy [http://db.apache.org/derby/docs/10.1/tools/rtoolsdblookexamples.html examples].