How to use DESC command in H2 Database?

h2
user1204320 picture user1204320 · Feb 14, 2012 · Viewed 31.2k times · Source

My friend showed me in ORACLE that using DESC Table NAme was showing information about columns of table. But running this command in H2 Database was giving error, Why? and please tell how to use this command in H2? Thanks.

Answer

Roberto picture Roberto · May 29, 2013

you can use the show command just like:

sql> show columns from users;

"users" is the table name, the output would be something like:

FIELD      | TYPE          | NULL | KEY | DEFAULT
ID         | INTEGER(10)   | NO   | PRI | (NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_B66F0B87_5AAA_4421_88AC_1E8CAC372596)
USERNAME   | VARCHAR(45)   | NO   |     | NULL
PASSWORD   | VARCHAR(100)  | YES  |     | NULL
FULL_NAME  | VARCHAR(100)  | YES  |     | NULL
LAST_LOGIN | TIMESTAMP(23) | YES  |     | NULL
(5 rows, 1 ms)