Tsallaka zuwa abun ciki
Justice Tech School

Revenue Report

Join and SUM to build money reports. Check totals against a simple query.

Example
SELECT c.title, COUNT(*) AS sales, SUM(c.price) AS revenue
FROM enrolments e JOIN courses c ON c.id = e.course_id
GROUP BY c.id ORDER BY revenue DESC;

Result

title         | sales | revenue
Python        | 3     | 36000
JavaScript    | 1     | 15000
SQL           | 1     | 8000
CSS Basics    | 1     | 5000
Intro to HTML | 2     | 0

Exercise

Add up amounts.

(price)

Quiz Test

What does SUM do?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.