Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I see table structure in HSQLDB?

Tags:

hsqldb

How can I see the structure (details of the columns etc) of a table in HSQLDB? It is not "desc" like Oracle, so what?

like image 344
Yasin Okumuş Avatar asked Aug 15 '11 20:08

Yasin Okumuş


People also ask

How do you display the structure of a table?

So desc or describe command shows the structure of table which include name of the column, data-type of column and the nullability which means, that column can contain null values or not.

How can I see the table layout in SQL?

To show table properties in the Properties window. In Object Explorer, select the table for which you want to show properties. Right-click the table and choose Properties from the shortcut menu. For more information, see Table Properties - SSMS.

Which query is used to view the structure of the table?

If we want to show the structure of a database table or tables in the server then, we will use the SQL command DESCRIBE or other keyword DESC, which is identical to DESCRIBE one.


2 Answers

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' 
like image 104
fredt Avatar answered Jan 24 '23 19:01

fredt


I use following query in HSQLDB to see column information of a particular table:

SELECT * FROM INFORMATION_SCHEMA.COLUMNS where table_name = '<TABLE_NAME>'
like image 36
Rajni Kewlani Avatar answered Jan 24 '23 18:01

Rajni Kewlani