/* Grouping the output */ SELECT price, max(course_id), max(description) FROM course GROUP BY price; SELECT price, MAX(course_id), MAX(description) FROM course WHERE description LIKE '%Web%' GROUP BY price; SELECT price, MAX(course_id), description FROM course WHERE description LIKE '%Web%' GROUP BY price, description; SELECT vendor, SUM(amount) AS paid, COUNT(amount) AS tally, AVG(amount) average FROM payment GROUP BY vendor; /* Multiple group by column */ SELECT vendor, description, SUM(amount) paid, COUNT(amount) tally FROM payment GROUP BY vendor, description; /* you can even group using functions */ SELECT concat(vendor, description), sum(amount) FROM payment WHERE description <> 'Home Insurance' GROUP BY concat(vendor, description);