Skip to main content
Practice

4

sql

-- View all clients
SELECT *
FROM clients;

-- Count how many clients there are in each region
SELECT region, COUNT(*) AS client_count
FROM clients
GROUP BY region;

-- Show total sales in each region
SELECT region, SUM(sales) AS total_sales
FROM clients
GROUP BY region;

-- Show average sales in each region
SELECT region, AVG(sales) AS avg_sales
FROM clients
GROUP BY region;

-- Show total orders in each region
SELECT region, SUM(orders_count) AS total_orders
FROM clients
GROUP BY region;

Want to learn more?

Join CodeFriends Plus membership or enroll in a course to start your journey.