(Solved) : Using Sql 3 Tables Users Movies Events Create Table Users Userid Integer Primary Key Usern Q42778098 . . .

Using SQL:

I have 3 tables, “users”, “movies”, and “events”

CREATE TABLE users (user_id INTEGER PRIMARY KEY, user_name TEXT,first_name TEXT, last_name TEXT, address TEXT, city TEXT, stateTEXT)

CREATE TABLE movies (movie_id INTEGER PRIMARY KEY, movie_nameTEXT, movie_score TEXT)

CREATE TABLE events (user_id INTEGER, movie_id INTEGER,date_watched TEXT)

The primary key for the events table is the concatenation ofuser_id, movie_id, date_watched. A user could have watched one ormore movies, one or more times. A movie could be watched by one ormore users, one or more times.

Write a SQL query for the following questions:

For each user_name, provide the latest date that they watchedany movie and the name of the movie they watched.

How would you include a column for the average number of moviesper user, and then find each users variance from the mean of thepopulation?

Prepare a list of the top 10 users with the highest averagemovie score (this is the average movie score of the movies theyhave watched). Include only the first and last name as a singlefield for each user.

Expert Answer


Answer to Using SQL: I have 3 tables, “users”, “movies”, and “events” CREATE TABLE users (user_id INTEGER PRIMARY KEY, user_name T…

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us

× How can I help you?