Sobes.tech
Junior — Middle

Have you had experience executing queries with grouping operations in SQL?

sobes.tech AI

Answer from AI

Yes, in SQL, grouping operations are performed using the GROUP BY keyword. It allows you to group rows by one or more columns and apply aggregate functions such as COUNT(), SUM(), AVG(), MAX(), MIN().

An example query that groups users by country and counts the number of users in each country:

SELECT country, COUNT(*) AS user_count
FROM users
GROUP BY country;

This query returns a list of countries and the number of users in each.