Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 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.40 Rating (125 Votes )

There are 3 Steps involved in it

Step: 1

3 day moving average of time spent on the website for usersusertype user can be calculated using ... blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Business Analytics Methods Models And Decisions

Authors: James R. Evans

2nd Edition

321997824, 978-1119298588, 978-0321997821

More Books

Students also viewed these Databases questions

Question

=+c) What are the factors?

Answered: 1 week ago