Aggregate Function – Assignment
1. Write a query to find both the minimum (MIN_SCORE) and maximum
(MAX_SCORE) scores from the SCORE column in the PERFORMANCE table. The
result should use the aliases MIN_SCORE and MAX_SCORE to label the output.
2. Write a query to find both the earliest (EARLIEST_GAME_DATE) and latest
(LATEST_GAME_DATE) game dates from the GAME_DATE column in the GAMES
table. The result should use the aliases EARLIEST_GAME_DATE and
LATEST_GAME_DATE to label the output.
3. Write a query to find the lexicographically smallest (MIN_GAME_NAME) and
largest (MAX_GAME_NAME) game names from the GAME_NAME column in the
GAMES table. The result should use the aliases MIN_GAME_NAME and
MAX_GAME_NAME to label the output.
4. Write a query to find both the minimum (MIN_PLAY_TIME) and maximum
(MAX_PLAY_TIME) play times from the PLAY_TIME column in the PERFORMANCE
table. The result should use the aliases MIN_PLAY_TIME and MAX_PLAY_TIME to
label the output.
5. Write a query to find the lexicographically smallest (MIN_PLAYER_NAME) and
largest (MAX_PLAYER_NAME) player names from the PLAYER_NAME column in
the PLAYERS table. The result should use the aliases MIN_PLAYER_NAME and
MAX_PLAYER_NAME to label the output.
1. Write a query to retrieve the destination and the average price of travel packages
(avg_price) from the TRAVEL_PACKAGES table. Only include destinations where
the average price is greater than 1500.
2. Write a query to get the package_id and the total number of tickets (total_tickets)
from the BOOKINGS table. Only include package IDs where the total number of
tickets is greater than 5.
3. Write a query to retrieve the city and the average age (avg_age) of customers from
the CUSTOMERS table. Only include cities where there is more than one
customer.
4. Write a query to find the package_id and the total sales amount (total_sales) from
the BOOKINGS table. Only include package IDs where the total sales amount is
greater than 2000.
5. Write a query to get the customer_id and the average number of tickets
(avg_tickets) per booking from the BOOKINGS table. Only include customers
where the total number of tickets is greater than 3.