从数据库中快速查找对应信息

昨天我需要修改接口Dto的属性与数据库中的字段匹配,我采用的是直接查询注释的方式,大部分写了注释的都能轻松找到。其他的需要通过理解表与表之间的关系才能找到对应字段。比如我需要查找“检测人员名称"属性,就需要考虑通过程序入口的那个表的“员工id”字段来查询“员工名称“。这时候用查注释的方式就不管用了,需要理解表结构。

-- 根据注释查询

select  column_name,table_name,data_type,column_comment from information_schema.columns  where column_comment like '%自动加入工单%';
-- 根据表名查询
select  column_name,table_name,data_type,column_comment from information_schema.columns  where table_name='hc_basic_tyre_problem';
-- 根据列名查询
select  column_name,table_name,data_type,column_comment from information_schema.columns  where column_name like '%id%';

猜你喜欢

转载自blog.csdn.net/qq_31247177/article/details/80117479