简体   繁体   English

如何使用元数据获取h2数据库的表结构

[英]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.我已经编写了 java 代码来连接到 H2 数据库(声纳的默认数据库)并使用元数据我可以看到每个表的所有表和列。 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.解决方案/帮助将不胜感激。

show columns from table_name;

这将显示列的数据类型、主键、初始值等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM