GROUP BY & DISTINCT in SQL

GROUP BY & DISTINCT in SQL

Here’s a detailed explanation of the difference between GROUP BY and DISTINCT, including table definition, sample data insertion, and examples. Step 1: Create the Sales Table CREATE TABLE Sales ( Product VARCHAR(50), Quantity INT ); Step 2: Insert Sample Data INSERT INTO Sales (Product, Quantity) VALUES (‘Apple’, 10), (‘Banana’, 5), (‘Apple’, 8), (‘Orange’, 7), (‘Banana’,…