Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are given the following relational schema. Passengers (pid:integer, pname:string, age:integer, city:string) Flights (fid:integer, from:string, to:string, miles:integer, aircraft:string) Tickets (pid:integer, fid:integer, price:integer) The database contains

image text in transcribed

You are given the following relational schema. Passengers (pid:integer, pname:string, age:integer, city:string) Flights (fid:integer, from:string, to:string, miles:integer, aircraft:string) Tickets (pid:integer, fid:integer, price:integer) The database contains passenger and flight information for an airline in a single day. The description is as follows: passengers are uniquely identified by pid and they have as attributes name, age and city of residence. Flights are uniquely identified by fid. Each flight has an origin and destination airport identified by from and to respectively (airport codes are 3-letter strings, and are unique - no two airports have the same code - you do not need to enforce that constraint, just assume it is respected), flight distance given by miles, and aircraft type, e.g., B737, B777, B787, A320, etc. The Tickets relation provides information of flights that passengers took, and also the price that was paid for that flight segment (assume that each ticket corresponds to a segment; for people with connecting flights, they will have separate tickets, billed independently). Write relational algebra expressions for the following queries given the schema above: (a) Find the names of passengers who traveled on a B787 aircraft and paid at most $800 for that ticket. (b) Find the ages of passengers who traveledonly on flights going in or out of BOS (assumes that they were on at least one flight). (c) List the prices of all tickets for flights on aircrafts of type B777. (d) Find the residence city of passengers who traveled on a flight longer than 500 miles, or who paid at most $500 for a ticket. (e) Find the origin of flights that had both passengers who reside in Boston and passengers who reside in Chicago. (f) Find the names of passengers who had connecting flights, defined as two flights where the origin of the second flight is the same as the destination of the first. Note that, return flights do not qualify as connecting flights (e.g., BOS to SFO and SFO to BOS is not a connecting flight, whereas BOS to JFK and JFK to LAX is a connecting flight)

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

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

Students also viewed these Databases questions

Question

What is the coefficient for QUANTITATIVE, b2?

Answered: 1 week ago