Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 1: [20 pt] Relational algebra. Following is the schema for character- episode-appearance relation Characters(name, type): assume characters have distinctive names name type BobA Appearances

image text in transcribed

Problem 1: [20 pt] Relational algebra. Following is the schema for character- episode-appearance relation Characters(name, type): assume characters have distinctive names name type BobA Appearances (name, season, num) Jon EmmaB Olivia C name season num Bob Bob 1 Jon Episodes (season, num, title, viewers) Jon2 Emma1 Emma 1 Emma 2 Bob 2 Olivia 2 season num title viewers Winter 2.5 M 2 King 2.5NM 1 Notes 4.0 M 2 Lands 3.2 M 2 2 If a query requires a join, and it is not a natural join, you should make the join condition explicit. (a) [5 pt] Write two equivalent relational algebra queries that list the types other than type A. (b) [5 pt] Write a relational algebra query that computes the names of characters that appear in both season 1 and season 2. (hint: choose from set operators such as union, intersect and set_diff) (c) [5 pt] Write a relational algebra query that computes the names of characters that appear in some episode with more than 3M viewers. (hint: join is needed) (d) [5 pt] Write a relational algebra query that computes pairs of characters that appear together in some episode in season 1. Each tuple of the output should have the format: (name1,type1,name2,type2,num). Exclude self pairs: (name1!- name2)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Students also viewed these Databases questions