Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I did a and b please correct me if i'm wrong. And answer c-d a) Select viewers From Episodes Where viewers > 3 Order by

image text in transcribed

I did a and b please correct me if i'm wrong. And answer c-d

a) Select viewers

From Episodes

Where viewers > 3

Order by viwers DESC, Season,, num;

b) Select name

From characters

Where A.num == E.num AND viewers>= 3.0m;

Characters(name, type): assume characters have distinctive names name type Bob A Jon A Emma B Olivia C Appearances (name, season, num) name season num Bob 1 Bob 1 Jon 2 Episodes(season, num, title, viewers) Jon 2 Emma1 Emma |1 Emma 2 Bob 2 season num title viewers 1 Winter 2.5 M King 2.5 M Notes |4.0 M 2 Lands 3.2 M 2 Olivia 2 Problem 2: [30 pt] Elementary SQL: write SQL queries using previous tables a)[5 pt] Find good episodes: find the episodes that have more than 3.0M viewers Sort by viewers in descending order, then by season in ascending order, and finally by number in ascending order. Format of each output row: (season, number, title, viewers) b)[5 pt] Find lucky characters: List names (remove duplicate) who appear in some episode with viewers>-3.0M. Format of each output row: (name). c)[5 pt] Find the number of unique characters for each episode. Format of each output row: (season, num, number_characters). d)[5 pt] Find the number of unique characters for each episode, such that there are at least two unique characters in that episode. Format of each output row: (season, num, number_characters). e)[5 pt] For each episode, find the number of unique characters whose type is A. Format of each output row: (season, num, number_characters) f [5pt] Find seasons (remove duplicate) in which Type A characters have NEVER appeared. Format of each output row: (season)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Database And Transaction Processing

Authors: Philip M. Lewis, Arthur Bernstein, Michael Kifer

1st Edition

0201708728, 978-0201708721

More Books

Students also viewed these Databases questions