How can I see the structure (details of the columns etc) of a table in HSQLDB? It is not "desc" like Oracle, so what?
Asked
Active
Viewed 1.8k times
10
-
related: http://stackoverflow.com/questions/2406470/inspect-hsqldb-schema – golimar Mar 01 '16 at 11:54
3 Answers
24
The information is provided by the views in the INFORMATION_SCHEMA
SELECT * FROM INFORMATION_SCHEMA.SYSTEM_TABLES
SELECT * FROM INFORMATION_SCHEMA.SYSTEM_COLUMNS
In version 2.x, additional views are available containing more detailed information:
SELECT * FROM INFORMATION_SCHEMA.TABLES
SELECT * FROM INFORMATION_SCHEMA.COLUMNS
You can select from single or joined views and filter the results on schema, table, column names and table type. The last you can use to show non-system tables only.
SELECT * FROM INFORMATION_SCHEMA.SYSTEM_TABLES where TABLE_TYPE='TABLE'
2
I use following query in HSQLDB to see column information of a particular table:
SELECT * FROM INFORMATION_SCHEMA.COLUMNS where table_name = '<TABLE_NAME>'

user
- 867
- 9
- 21
0
user's answer works, but I find the following yields easier to read output in a terminal:
SELECT * FROM INFORMATION_SCHEMA.SYSTEM_COLUMNS WHERE TABLE_NAME='tablename';

pacoverflow
- 3,726
- 11
- 41
- 71