码迷,mamicode.com
首页 > 其他好文 > 详细

Select 1 from table and Select any col from table

时间:2015-08-21 15:14:07      阅读:200      评论:0      收藏:0      [点我收藏+]

标签:

  1.  select 1 from table ;select any col from      table (any col is any row of purpose collection) ;select * from table 作用上来说是没有差别的,都是查看是否有数据记录,一般是做条件用的。Select 1 from table中的1 是一个常量,查到所有的值都是它,但是从效率上来说 1> anycol >      *,因为不用查字典表。
  2. 查看记录条数时可以用 select count(1)from table 等价于select count(*)      from mytable;

Select 1 from table and Select any col from table

标签:

原文地址:http://www.cnblogs.com/zhanggongchang/p/4747807.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!