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.
Accessing the H2 Console H2 database has an embedded GUI console for browsing the contents of a database and running SQL queries. By default, the H2 console is not enabled in Spring. Then, after starting the application, we can navigate to http://localhost:8080/h2-console, which will present us with a login page.
Access the H2 Console You can access the console at the following URL: http://localhost:8080/h2-console/. You need to enter the JDBC URL, and credentials. To access the test database that the greeter quickstart uses, enter these details: JDBC URL: jdbc:h2:mem:greeter-quickstart;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1.
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)
The H2 database does not support the SQL statement DESC
.
It does support SHOW
however, as documented. Example:
SHOW TABLES
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With