加入收藏 | 设为首页 | 会员中心 | 我要投稿 济南站长网 (https://www.0531zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MySql教程 > 正文

MySQL分页方法

发布时间:2016-08-16 06:34:27 所属栏目:MySql教程 来源:站长网
导读:环境 MySQL 5.1 + 命令行工具 问题 MySQL分页 解决 --创建测试表 create table test ( id int(11) primary key auto_increment, name varchar(20) not null); -
环境

MySQL 5.1 + 命令行工具

问题

MySQL分页

解决

--创建测

试表  
create table test  
(  
    id int(11) primary key auto_increment,  
    name varchar(20) not null
);  
       
--插入数据  
mysql> insert into test(name) values('test1');  
Query OK, 1 row affected (0.16 sec)  
       
mysql> insert into test(name) values('test2');  
Query OK, 1 row affected (0.01 sec)  
       
mysql> insert into test(name) values('test3');  
Query OK, 1 row affected (0.00 sec)  
       
mysql> insert into test(name) values('test4');  
Query OK, 1 row affected (0.00 sec)  
       
mysql> insert into test(name) values('test5');  
Query OK, 1 row affected (0.03 sec)  
       
mysql> insert into test(name) values('test6');  
Query OK, 1 row affected (0.01 sec)  
       
mysql> insert into test(name) values('test7');  
Query OK, 1 row affected (0.06 sec)  
       
mysql> insert into test(name) values('test8');  
Query OK, 1 row affected (0.00 sec)  
       
mysql> insert into test(name) values('test9');  
Query OK, 1 row affected (0.01 sec)  
       
mysql> insert into test(name) values('test10');  
Query OK, 1 row affected (0.01 sec)  
--执行分页  
mysql> select id,name from test limit 0,10;  
+----+--------+  
| id | name   |  
+----+--------+  
|  1 | test1  |  
|  2 | test2  |  
|  3 | test3  |  
|  4 | test4  |  
|  5 | test5  |  
|  6 | test6  |  
|  7 | test7  |  
|  8 | test8  |  
|  9 | test9  |  
| 10 | test10 |  
+----+--------+  
10 rows in set (0.00 sec)

(编辑:济南站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读