Question: There is a database that contains a website's traffic data over a period of 30 days. The first table contains users' information including the

There is a database that contains a website's traffic data over a

There is a database that contains a website's traffic data over a period of 30 days. The first table contains users' information including the user type (user, crawler, admin). The second table consists of the time of each visit to the website, the id of the visitor, time spent on the website in seconds. Write an SQL query to show the 3 day moving average of time spent on the website for users.user_type = 'user'. Note: avg time spent must have 4 decimal digits and rounded off (example: 5/3 = 1.6667, 5/2 = 2.5000 and 1/3= 0.3333) Schema There are 2 tables: users, traffic Name id name Name user_type VARCHAR Type of the user user_id visited_on users time spent Type Description INTEGER The user's unique id. It is the primary key. VARCHAR This is the second column and the name of the user. traffic Type INTEGER DATE INTEGER time spent on website in seconds Description id of the user from the users table. date on which the user visited the website

Step by Step Solution

3.44 Rating (151 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The question in the image asks for an SQL query to show the 3day moving average of the time spent on ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!