SQLTeam.com | Weblogs | Forums

SQL Question

Company table has ID and name of the company, which transports passengers. Trip table has information about trips: trip number, company ID, plane type, departure city, arrival city, departure time and arrival time. The passenger table has passenger's ID and passenger's name. Pass_in_trip table has information about the flights: trip number, departure date (day), passenger's ID and his place during the flight.

• Company (ID_comp, name)
• Trip (trip_no, id_comp, plane, town_from, town_to, time_out,time_in)
• Passenger (ID_psg, name)
• Pass_in_trip (trip_no, date, ID_psg, place)

Note:
• Every day, one or more trips happen.
• Duration of all the flights is less than a calendar-day (24 hours).
• Time and date of all trips are considered to be in the same time zone.
• The departure time and the arrival time are stored to within a minute.
• There can be 2 passengers with the same names (for example, Bruce Willis).
• Relationships and restrictions are shown in the data schema.

What is the SQL query for below question
2. For the days between 2003-04-01 and 2003-04-07, find the number of trips from the town Rostov.

Can you show us what have you tried till now or stuck somewhere?