For the questions below, consider the following schema
BusRoutes (RNo, from, to, distance, price)
Bus (BID, BusName, TravelRange)
Allowed (EID, BID)
Employees (EID, EName, Salary)
BusRoutes table gives the information for bus routes (RNo), where the bus leaves from, where it is going to, the distance between the two points, and the price for this route (end to end).
Employees table contains information on Bus Drivers, and other employees. Every driver is allowed to drive for some Bus (or he/she won't be a driver ;), and only drivers can drive a bus (not other employees).
Write the following queries in SQL:
a. Find the Employee ID and the maximum travel range of the Bus for each Driver who is certified for that bus and at least two other Buses.
b. Find the drivers (i.e. their names) whose salary is less than the price of the cheapest route from Boston to LA.
Recently Asked Questions
- What are some good “remote” causes of why someone would want to attend college? In general
- How should I work on a problem that utilizes logs I’m having a little difficulty trying to solve equations that use logs
- Why each organisation should have policies, procedures and practices that support effective risk identification ?