Home > Database > Mysql Tutorial > mysql中limit的使用_MySQL

mysql中limit的使用_MySQL

WBOY
Release: 2016-06-01 13:48:08
Original
954 people have browsed it

bitsCN.com
mysql中limit的使用 mysql中没有top,替而代之的是limit关键字,具体使用方法如下: mysql> select * from test;   +----+------+-----+----------+--------------+ | id | name | age | tel      | address      | +----+------+-----+----------+--------------+ |  1 | aaaa |  12 | aaaaaa   | aaaaaaaaa    | |  2 | bbbb |  12 | 12312312 | asgdsf       | |  3 | bbb  |  23 | 123423   | asdfsafd     | |  5 | asdf |  23 | asfdsd   | asdgesadg    | |  7 | sadf |  23 | asgsdg   | asgsdfsafsdf | +----+------+-----+----------+--------------+ 5 rows in set (0.00 sec) mysql> select * from test limit 2,5     -> ;+----+------+-----+--------+--------------+ | id | name | age | tel    | address      | +----+------+-----+--------+--------------+ |  3 | bbb  |  23 | 123423 | asdfsafd     | |  5 | asdf |  23 | asfdsd | asdgesadg    | |  7 | sadf |  23 | asgsdg | asgsdfsafsdf | +----+------+-----+--------+--------------+ 3 rows in set (0.00 sec)   mysql> select * from test limit 2,4; +----+------+-----+--------+--------------+ | id | name | age | tel    | address      | +----+------+-----+--------+--------------+ |  3 | bbb  |  23 | 123423 | asdfsafd     | |  5 | asdf |  23 | asfdsd | asdgesadg    | |  7 | sadf |  23 | asgsdg | asgsdfsafsdf | +----+------+-----+--------+--------------+ 3 rows in set (0.00 sec) mysql> select * from test order by name limit 2,4; +----+------+-----+----------+--------------+ | id | name | age | tel      | address      | +----+------+-----+----------+--------------+ |  3 | bbb  |  23 | 123423   | asdfsafd     | |  2 | bbbb |  12 | 12312312 | asgdsf       | |  7 | sadf |  23 | asgsdg   | asgsdfsafsdf | +----+------+-----+----------+--------------+   3 rows in set (0.00 sec) bitsCN.com

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template