如何查询数据库表名和注释
查询数据库表名和注释
以下SQL语句可以帮助您检索不同数据库系统中的表名和注释:
MySQL
SELECT table_name, table_comment
FROM information_schema.tables
WHERE table_schema = 'your_database_name';
Oracle
SELECT table_name, comments
FROM user_tab_comments;
SQL Server
SELECT sys.objects.name AS table_name, sys.extended_properties.value AS table_comment
FROM sys.objects
LEFT JOIN sys.extended_properties ON sys.objects.object_id = sys.extended_properties.major_id AND sys.extended_properties.minor_id = 0 AND sys.extended_properties.name = 'MS_Description'
WHERE sys.objects.type_desc = 'USER_TABLE';
请根据您的数据库系统选择合适的语句并替换'your_database_name'为您的数据库名称。
原文地址: https://www.cveoy.top/t/topic/lzZS 著作权归作者所有。请勿转载和采集!