Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get table structure for h2 database using metadata

I have written java code to connect to H2 database(sonar's default database) and using metadata I can see all tables and columns for each table. But I want to see table structure(like Primary key, foreign key, number of records in table). How can I view table structure using metadata? or Is there any other approach for viewing table structure?

Solution/help would be highly appreciated.

like image 402
Dhiraj Avatar asked Jan 12 '15 12:01

Dhiraj


1 Answers

show columns from table_name;

This will show you the data type of columns, primary key, initial values etc.

like image 164
Mahesh Kshirsagar Avatar answered Oct 23 '22 00:10

Mahesh Kshirsagar