derby 系统数据字典,表名列名

derby数据库也存在数据字典表,中文的网上资料很少,放这里备忘。

列出数据库所有表:

select columnnumber, tablenane, columnname, columndatatype
    from sys.systables t, sys.syscolumns, sys.sysschemas s
    where tableid=referenceid and t.schemaid=s.schemaid

列出所有列:

 select s.schemaname || '.' || t.tablename 
     from sys.systables t, sys.sysschemas s 
     where t.schemaid = s.schemaid
          and t.tabletype = 'T'
     order by s.schemaname, t.tablename
 
列出所有表和对应的列名:
SELECT
t.tablename as stablename,c.columnname as scolumnname
FROM sys.systables t , sys.syscolumns c, sys.sysschemas s
where t.schemaid=s.schemaid
AND t.tableid = c.referenceid
and t.tabletype = 'T'
posted @ 2011-12-21 22:07  weiwelcome0  阅读(1390)  评论(0编辑  收藏  举报