当前位置:网站首页>Barbie q! How to analyze the new game app?
Barbie q! How to analyze the new game app?
2022-07-28 04:58:00 【Monkey data analysis】
【 subject 】
In order to monitor the newly listed Games APP Popularity of , Analyze the total number of users through data 、 Average age of users and active users ( Visit for two consecutive days ) The total number and average age of . The following table shows the details of user login information table .
Field explanation :
Login date : Record user login to the game APP Time for
user ID: The unique identification of the user
User age : The user is in APP Age of registration
The following results need to be analyzed :
1. Count the total number of users 、 Average age of users
2. Count active users ( Visit for two consecutive days ) The total number and average age of
【 Their thinking 】
1. Count the total number of users 、 Average age of users
From table 1, you can see that the same user has multiple login records on the same day , If you perform aggregate queries directly, it will cause duplicate data calculation , So you should first follow the user ID The de emphasis of duplicate data is to analyze the total number and average age of users .
SQL Writing a :
select distinct user ID, User age
from User login information table ;SQL Write two :
select user ID, User age
from User login information table
group by user ID;Query results :
The query results are used as temporary tables a, Next, use to calculate the number of users (count function ) And ask the average age of users (avg function )
SQL It is written as follows :
select count( user ID) as Total users ,avg( User age ) as Average age of users
from(
select user ID, User age
from User login information table
group by user ID
) a;Query results :
2. Count active users ( Visit for two consecutive days ) The total number and average age of
Active users : It is positioned as having access for two consecutive days , The vernacular is interpreted as logging in today , Number of users logged in tomorrow . That is, the time interval =1.
If a table involves time intervals , You need to use self connection , That is to join two identical tables . Will table a Understood as the user's login time , Will table b Understood as the user's login time again , By calculating the time difference between login time and login time again , The time difference is equal to 1 That means you are also logged in today , Log in tomorrow ( Log in for two consecutive days )
select
a. Login date as The login time ,
a. user ID,
a. User age ,
b. Login date as Login time again
from
User login information table as a
left join User login information table as b on a. user ID = b. user ID;Query results :
The temporary table after connection is marked as table c, So how to start from the table c Find out the time interval ( Landing time tomorrow - Today's landing time )=1 What about the data? ?
(1) This involves calculating the difference between two dates ,《 monkey Learn from scratch sql》 The corresponding single function mentioned in is timestampdiff. The following figure shows the usage of this function .
SQL Write the following :
select *,timestampdiff(day,c. The login time ,c. Logout time ) as The time interval
From c
group by c. user ID,c. The login time ;Query results :
The query results are used as temporary tables d, use case when Statement selects the time interval =1 The data of , Calculate the total number of active users (count) And the average age of active users (avg)
SQL Write the following :
select count(distinct case when The time interval =1 then user ID else null end ) as Total active users ,
avg( case when The time interval =1 then User age else null end ) as Average age of active users
from d;Put the temporary table d Of SQL Plug in , Final SQL The code is as follows :
select
count(distinct case when The time interval =1 then user ID else null end ) as Total active users ,
avg( case when The time interval =1 then User age else null end ) as Average age of active users
from
(
select *,timestampdiff(day,c. The login time ,c. Login time again ) as The time interval
from
(
select
a. Login date as The login time ,
a. user ID,
a. User age ,
b. Login date as Login time again
from User login information table as a
left join User login information table as b on a. user ID = b. user ID
) c
group by c. user ID,c. The login time
) d;Query results :
【 The test point of this question 】
1. Understanding of common indicators , For example, the number of retained users 、 Retention .
2. Flexible use case To statistics when Function and group by Perform custom column statistics .
3. Encountered only one table , But the problem of counting time intervals , We need to think of using self connection to find the time interval , Similar to finding continuity appear N The content of this time 、 sound of dripping water 2020 True job title 、 Chain home interview questions : How to analyze retention .
边栏推荐
- HDU 2586 How far away ? (LCA multiplication method)
- Improve the core quality of steam education among students
- RT based_ Distributed wireless temperature monitoring system based on thread
- Youxuan database participated in the compilation of the Research Report on database development (2022) of the China Academy of communications and communications
- [idea] check out master invalid path problem
- Gerrit operation - rollback a patch_ set
- Basic knowledge of network security - password (I)
- printf()打印char* str
- Leetcode 18. sum of four numbers
- set与list性能对比
猜你喜欢

Easycvr Video Square snapshot adding device channel offline reason display

Leetcode 454. Adding four numbers II
![String 0123456789abcdef, what is the number of substrings (not empty and not the same string itself) [Hangzhou multi tester] [Hangzhou multi tester _ Wang Sir]](/img/78/efe3d70a4bfe8ac0c9b58b54d02b00.png)
String 0123456789abcdef, what is the number of substrings (not empty and not the same string itself) [Hangzhou multi tester] [Hangzhou multi tester _ Wang Sir]

FreeRTOS startup process, coding style and debugging method

Visual studio 2019 new OpenGL project does not need to reconfigure the environment

Know etcd

FreeRTOS learning (I)

RT based_ Distributed wireless temperature monitoring system based on thread

Web渗透之域名(子域名)收集方法
![(2.4) [service Trojan -slimftp] introduction and use](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)
(2.4) [service Trojan -slimftp] introduction and use
随机推荐
alter和confirm,prompt的区别
启发国内学子学习少儿机器人编程教育
HDU 3585 maximum shortest distance
Odoo action analysis (action.client, action.act_window, action.server)
Transformer -- Analysis and application of attention model
Mysql database -- first knowledge database
Check box error
Rendering process, how the code becomes a page (2)
Introduction to testcafe
RT based_ Distributed wireless temperature monitoring system of thread (I)
Array or object, date operation
Gym 101911c bacteria (minimum stack)
Activation functions sigmoid, tanh, relu in convolutional neural networks
Chuangyuan will join hands with 50+ cloud native enterprises to explore new models to cross the digital divide
FPGA: use PWM wave to control LED brightness
Special topic of APP performance design and Optimization - poor implementation affecting performance
HDU 1435 stable match
低代码是开发的未来吗?浅谈低代码平台
[Sylar] framework chapter -chapter21- environment variable module
[daily one] visual studio2015 installation in ancient times