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

MySQL查询中LIMIT关键字有什么用?

2024/3/3 0:42:45发布20次查看
mysql中的limit关键字可以指定输出中返回的记录数。 limit 子句限制要返回的行数。可以通过以下示例来理解 -
示例mysql> select * from student_info;+------+---------+------------+------------+| id | name | address | subject |+------+---------+------------+------------+| 101 | yashpal | amritsar | history || 105 | gaurav | chandigarh | literature || 125 | raman | shimla | computers || 130 | ram | jhansi | computers || 132 | shyam | chandigarh | economics || 133 | mohan | delhi | computers || 150 | saurabh | null | literature |+------+---------+------------+------------+7 rows in set (0.00 sec)
上面的结果集显示表“student_info”总共有 7 行。
但是,如果我们只想在输出中获取前 2 行,那么我们可以使用 limit关键字后跟 2,如下 -
mysql> select * from student_info limit 2;+------+---------+------------+------------+| id | name | address | subject |+------+---------+------------+------------+| 101 | yashpal | amritsar | history || 105 | gaurav | chandigarh | literature |+------+---------+------------+------------+2 rows in set (0.00 sec)
以上就是mysql查询中limit关键字有什么用?的详细内容。
该用户其它信息

VIP推荐

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