您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

“select 1 from table”什么意思

2024/3/1 3:11:09发布21次查看
“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”什么意思的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product