2. Nested Subqueries
More Complex Filtering
But we can also make more complicated filtering, for example, by two columns. Let's see the syntax of such filtering.
It will be easier to understand it in practice!
You have to find the subway lines (
line_name column) with a total ride time (using the
time_to_next_station column and
SUM() function create new one, named
total_time) of more than 50 minutes and total number of stations (using the
station_name column and
COUNT() function create new one, named
number_of_stations) on this line is greater than 5.
Here's a short example of the
Everything was clear?