Question
(Please hand write this) Relational algebra. Following is the schema for characterepisode-appearance relation. Characters(name, type): assume characters have distinctive names. If a query requires a
(Please hand write this)
Relational algebra. Following is the schema for characterepisode-appearance relation.
Characters(name, type): assume characters have distinctive names.
If a query requires a join, and it is not a natural join, you should make the join condition explicit.
a. Write two equivalent relational algebra queries that list the types other than type A.
b. 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. 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. 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).
name type Bob A Jon A Emma B Olivia C pearances (name, seas son, num) name season num Bob 1 Bob1 Jon1 Jon 2 Emma1 Emma 1 Emma 2 Bob 2 Olivia 2 Episodes(season, num, title, viewers) seasonnum t title vie wers 1 Winter 2.5 M 2 King 2.5 M Notes 4.0 M Lands 3.2 M 2 2 2Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started