0

Here are the following relations:

Trips (ID, TripState, TravelMode, Fare)

ByCar(ID, Rental Company, Mileage)

ByTrain (ID, Type, Coach, TrainSpeed, NumberofStops)

ByPlane(ID, Airline, Class, LayoverTime)

Use relational algebra to find the details of the most costly trip (highest fare) (without using specific numbers)

The queries must work arbitrary data, not just the provided data.

Here is some sample data: https://www.dropbox.com/s/4n3z2di7f747u2e/SampleTripData.csv?dl=0

my answer that is probably wrong

My answer in copyable text format:

π (Fare(F1(Trips)) X Fare(F2(Trips)) - σ(ID, F1.Fare >= F2.Fare)(Trips)

My question is, how should I find the maximum cost of the trips (fare) in this case? (I can't use sql, only relational algebra)

  • Why do you propose this? Why do you think it wrong? What parts do you think are right & at what? See [this](http://stackoverflow.com/a/41800639/3404097). Please read [ask]. Please give a reference to the version of RA are you using. Moreover, your use of operators doesn't seem to make sense. PS Please use text not images. Use code blocks for tables. – philipxy Jan 24 '17 at 04:26
  • @Eric The parentheses in your answer aren't balanced, your projection doesn't have a list of attributes, you use `Fare` like a function/operator, you rename relations instead of attributes, `ID,` isn't valid in the condition for the selection operator, and selection can't refer to `F1` or `F2` if those relations are defined independent of its argument. – reaanb Jan 24 '17 at 09:05

0 Answers0