MySQL分頁的實現,MySQL分頁實現

來源:互聯網
上載者:User

MySQL分頁的實現,MySQL分頁實現
mysql> select pname from product;+--------+| pname  |+--------+| 產品1  || 產品2  || 產品三 |+--------+3 rows in set (0.00 sec)這個地方是說,從product中選出所有的pname來,一共有三條記錄。MySQL中的分頁非常簡單,我們可以使用limit比如:mysql> select pname from product limit 0,2;+-------+| pname |+-------+| 產品1 || 產品2 |+-------+2 rows in set (0.00 sec)Limit用法如下:第一個參數是指要開始的地方,第二個參數是指每頁顯示多少條資料;注意:第一頁用0表示。

Mysql分頁:

          select * from tableName where 條件  limit 當前頁碼*頁面容量-1 , 頁面容量

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.