https://img2020.cnblogs.com/blog/1101843/202010/1101843-20201029092119794-1182278230.jpg

支付宝

https://img2020.cnblogs.com/blog/1101843/202010/1101843-20201029091740174-1560674849.png

微 信

MYSQL 数据库名、表名、字段名查询

 //查询所有表的所有字段:

select * from information_schema.columns where table_name='sys_users' 

 效果:

 

//查询指定表的所有字段:

select * from information_schema.columns where table_name='sys_users' and TABLE_SCHEMA='taoke'

效果:

 //查询指定表的所有字段的指定类型,注释:

查询所有含有此字段名的表:

SELECT * FROM information_schema.columns WHERE column_name='name';

查询指定数据库含有此字段名的表:

SELECT * FROM information_schema.columns WHERE column_name='name' and TABLE_SCHEMA='wljdb';

 

查询指定表数据库指定表的所有字段

select column_name from information_schema.COLUMNS where table_name='sys_users' and TABLE_SCHEMA='taoke'

查询指定表数据库指定表的第二个字段名:

select column_name from information_schema.COLUMNS where table_name='sys_users' and TABLE_SCHEMA='taoke' LIMIT 1,1

以上,举一反三

---------------------完毕----------------------------

 

 

-----------------------------------------------------------------------------

 

 

 

  

 

posted @ 2017-06-07 21:53  huangwanlin  阅读(39885)  评论(2编辑  收藏  举报
Copyright 2012-2021 林云希科技有限责任公司