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'