EXISTS(select 1 from )
指定一个子查询,检测行的存在。 返回结果为true或者时false
select 1 from
select 1 from mytable; 
与select anycol(目的表集合中的任意一行) from mytable;
与select * from mytable 作用上来说是没有差别的,都是查看是否有记录,一般是作条件用的。
select 1 from 中的1是一常量,查到的所有行的值都是它,但从效率上来说,1>anycol>*,因为不用查字典表。
count(1)
查看记录条数可以用select count(1) from mytable;
等价于select count(*) from mytable;

 

posted on 2018-08-03 09:10  倔强的乐  阅读(94)  评论(0编辑  收藏  举报