Task: Text to Code
Input (English): Step 1: for each value of Farm_ID in farm table, calculate summation of Total_Horses.
Step 2: show each value of Farm_ID in farm table along with the corresponding summation of Sheep_and_Goats ordered ascending by the results of step 1
Output (English): SELECT Pigs , Sum ( Sheep_and_Goats ) FROM farm GROUP BY Farm_ID ORDER BY Sum ( Total_Horses ) Asc