This exercise uses products, sales and customers to build practical sales reports with aggregation and LEFT JOIN. The queries also show the anti-join pattern for finding products or customers with no matching sales.
When aggregate queries select nonaggregated columns, group by the columns that define the row. This keeps the examples compatible with MySQL's default ONLY_FULL_GROUP_BY behavior.
There are three tables in total
customers
c_id , customer ( 8 records)
products
p_id, product and price
( 8 records )
sales
sale_id, c_id ( customer id ), p_id (product_id), qty ( quantity sold) ,store ( name )
Dive into the world of relational databases with this in-depth tutorial. Learn how to create and manage interconnected tables for products, customers, and sales using SQLite.
Enhance your Python applications by leveraging Tkinter to design user-friendly interfaces and generate dynamic reports. A perfect guide for mastering data relationships and
crafting interactive database-driven applications.
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery,
and web development at plus2net. The tutorials focus on clear explanations, working
examples, and code that readers can test and adapt while learning.