Senior
Task 1: Find the top 5 routes (departure_station, arrival_station) by the number of tasks for January 2025 from the harvester_tasks_queue table.
sobes.tech AI
Answer from AI
To find the top 5 routes (departure_station, arrival_station) by the number of tasks for January 2025 from the harvester_tasks_queue table, you can use the following SQL query:
SELECT departure_station, arrival_station, COUNT(*) AS task_count
FROM harvester_tasks_queue
WHERE task_date >= '2025-01-01' AND task_date < '2025-02-01'
GROUP BY departure_station, arrival_station
ORDER BY task_count DESC
LIMIT 5;
It is assumed that the table has a date field for the task, such as task_date. The query groups tasks by routes, counts the number of tasks for each route in January 2025, and outputs the top 5 by descending task count.