In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article focuses on "how mysql limits the number of queries". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how mysql limits the number of queries.
In mysql, you can limit the number of queries by using the "LIMIT" keyword in the SELECT query statement, which specifies which records the query results are displayed from and how many records are displayed; syntax "SELECT {* | Field column name} FROM data Table LIMIT initial location, number of records;"
The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.
When there are tens of thousands of data in the data table, querying all the data in the table at once will reduce the speed of data return and cause great pressure on the database server. It is necessary to limit the number of queries.
In mysql, you can limit the number of queries by using the "LIMIT" keyword in SELECT query statements.
The Mysql Limit keyword is used to limit the number of query results, and you can specify which records the query results are displayed from and how many records are displayed.
For example, a large table has 10 million data. Querying all the data processing at one time will take up a lot of resources, resulting in slow query results. At this time, you can use Limit to get the specified number of entries, only the number of entries we need.
Statements that limit the number of queries:
SELECT {* | Field column name} FROM data table name LIMIT initial location, number of records
Among them
"initial position" indicates the record from which to display, which can be omitted. The position of the first record is 0 and the position of the second record is 1. The following records are in turn and so on.
"number of records" indicates the number of records displayed.
Note: both parameters after LIMIT must be positive integers.
Example:
Do not specify the starting position
If the starting position is not specified by default, it will be obtained from the first item, for example, the following statement: get three pieces of data from the students table
SELECT * FROM students LIMIT 3
If the value of the number of records is less than the total number of query results, the specified number of records are displayed starting with the first record. If the value of the number of records is greater than the total number of query results, all records from the query are directly displayed.
Specify the starting location
The starting position is to get the data from which to start, such as the following statement: get two pieces of data from the first.
SELECT * FROM students LIMIT 0Pol 2
At this point, I believe you have a deeper understanding of "how mysql limits the number of queries". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.