Select 1 from table and Select any col from table

  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;

posted on 2015-08-21 14:27  弓长*  阅读(431)  评论(0编辑  收藏  举报

导航