“select 1 from table”什么意思

(图1)

"select 1 from table"什么意思

select 1 from table 与Select * from table在用法上大同小异,具体不同分析见下文:

1、select 1 from mytable;与select anycol(目的表集合中的任意一行) from mytable;与select * from mytable 作用上来说是没有差别的,都是查看是否有记录,一般是作条件用的。

select 1 from 中的1是一常量,查到的所有行的值都是它,但从效率上来说,1>anycol>*,因为不用查字典表。

2、查看记录条数可以用select sum(1) from mytable;等价于select sum(*) from mytable;

相关文章教程推荐:mysql教程

以上就是“select 1 from table”什么意思的详细内容,更多请关注其它相关文章!

1、本站目前拥有近 1000+ 精品收费资源,现在加入VIP会员即可全部下载。
2、本资源部分来源其他付费资源平台或互联网收集,如有侵权请联系及时处理。
SEA模板网 » “select 1 from table”什么意思

发表评论

加入本站VIP会员订阅计划,海量资源免费查看

目前为止共有 3654 位优秀的VIP会员加入! 立刻加入VIP会员