偶然间用到的sql语句

1.在mysql中如何查询某字段在哪个表中?

select table_schema,table_name from information_schema.columns where column_name = '字段名'
  • table_schema 数据库名称
  • table_name 表名
  • column_name = '字段名'(要查询的列)

举个栗子,在mysql中查找查询PassWord字段在哪个表中:

select table_schema,table_name from information_schema.columns where column_name = 'PassWord'

结果如下 :

猜你喜欢

转载自blog.csdn.net/m0_60199181/article/details/124274994
今日推荐