In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "what are the commonly used query time period methods in MySql". In the daily operation, I believe that many people have doubts about what commonly used query time period methods in MySql. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the questions of "what commonly used query time period methods are in MySql?" Next, please follow the editor to study!
There are many ways for MySql to query time periods. The time fields of MySql include date, time, datetime, timestamp and so on. Often, when we store data, we store the whole time in one field, using datetime type; it is also possible to separate date and time, that is, one field stores date and one field stores time time. No matter how it is stored, in practical applications, there is likely to be a query containing a "time period" type, such as an access record database, which needs to count the number of visits per day, which is a time period. Two common methods for querying time periods in MySql are described below, and other databases can be implemented similarly. The following editor to explain the commonly used MySql query time period what are the methods?
What are the common methods of querying time periods in MySql
Method 1: the traditional way, that is, specify the start time and end time, use "between" or "" to establish conditions, such as query the number of data items from March 1, 2010 to March 2, 2010, you can use the
Selectcount (*) fromsometablewheredatetimecolumn > = '2010-03-0100:00:00'anddatetimecolumn=UNIX_TIMESTAMP (' 2010-03-0100 0100:00:00'anddatetimecolumn=UNIX_TIMESTAMP 0000') anddatetimecolumn
You can also convert to UNIX time in the caller and then pass in MySql. In short, this method is good for querying the time period quickly, but the display time needs to be reversed again.
At this point, the study of "what are the commonly used query time period methods for MySql" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.