In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
For example: a user table has a user_id self-incrementing primary key and a create_time user creation time
Business requirements allow you to count the total number of users per day and how many users have increased compared to the previous day
As shown in figure 2.
First of all, check out the total amount of each day. The time in the table is generally of date_time type, so use a function.
SELECT DATE_FORMAT (create_time,'%Y-%m-%d') dd,COUNT (*) num FROM USER GROUP BY DATE_FORMAT (create_time,'%y-%m-%d')
Use the previous SQL as a statistical table to calculate the incremental SQL. You can try it for yourself.
SELECT a.dd.nummam (lt.num) AS cum FROM (SELECT DATE_FORMAT (create_time,'%Y-%m-%d') dd,COUNT (*) num FROM USER GROUP BY DATE_FORMAT (create_time,'%y-%m-%d')) aJOIN (SELECT DATE_FORMAT (create_time,'%Y-%m-%d') dd,COUNT (*) num FROM USER GROUP BY DATE_FORMAT (create_time) '% ymi% mmi% d') ltON a.dd > = lt.dd GROUP BY dd
(table 1) (Table 2)
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.