MySQL automatic number field paging Query

Source: Internet
Author: User

 

 

 

MySQL automatic number field

When creating a table:
Create Table 'mydatabase'. 'mytable '(
'Id' integer unsigned not null auto_increment,
...
...
Primary Key ('id ')
)
If the table already exists, modify it.
Alter table 'mydatabase'. 'mytable'
Modify column 'id' integer unsigned not null auto_increment;
Auto_increment is the automatic number

Original article address

Http://asp3000.blog.163.com/blog/static/8806120620091017103238664/

MySQL paging Query

Use query statements
Select * from table
.....
Limit a, B
A and B indicate records from A to B.
For example:
The limit 1,100
The limit 101,200
...
You only need to change the values of A and B in the query statement to obtain the set returned by different pages.
The total number of retrieved records is
Select count (*) from table .....
On the page, you only need to get the total number and divide it by the page size you want to calculate the total number of pages. Then, you can set your, the two parameters B are passed to the backend for distribution.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.