mysql玩法

如何字段名查找所在的表名

SELECT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME = '字段名字'
select syscolumns.name,sysobjects.name from syscolumns , sysobjects where syscolumns.id = sysobjects.id and syscolumns.name='已知字段名
select * from user where username='张三' or username='李四'优化为可写成:select * from user where username in('张三','李四')技术点就是,sql中where条件用'in'要比用"="效率要高,在千万级查询时效果比较明显

 

posted @ 2016-12-14 18:01  雨落知音  阅读(219)  评论(0编辑  收藏  举报