Question: Using Oracle, I have a table: Trips: (ID, Destination, Method, Fare) Train: (ID, Railway, SeatClass, Trainspeed, NumberOfStops) Using the Trips table, how can I write

Using Oracle, I have a table:

Trips: (ID, Destination, Method, Fare)

Train: (ID, Railway, SeatClass, Trainspeed, NumberOfStops)

Using the Trips table, how can I write SQL to find a trip to the same destination that can be taken by car but is more expensive than by train? Is this a Union or Intersect?

Using Train Table I need to find the train trips that have the same speed.

Using Trips I need to find trips that have the same destination and method of travel and list them only once.

I also need to find the most expensive and the cheapest trip - I think I need to use min(fare) and max(fare) for this but how can I union the tables to get all the info? For example if I wanted to return the train details for the min(fare), how would I do that? I keep getting an error because the data values are not the same.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!