MySQL Group by SUM

I have category in a table like

table(cat_name,amount);

How to get the sum of amount each cat_name Grouped by cat_name


Solution 1:

SELECT cat_name, SUM(amount) AS total_amount
FROM table
GROUP BY cat_name

Solution 2:

SELECT cat_name, SUM(amount) AS TotalAmount
FROM Table
GROUP BY cat_name