The GROUP BY clause is used to group data based on one or more columns. The HAVING clause is used to filter grouped data. For example: $ \(SELECT country, COUNT(*) FROM customers GROUP BY country HAVING COUNT(*)>10;\) $

The WHERE clause is used to filter data based on conditions. For example: $ \(SELECT * FROM customers WHERE country='USA';\) $

The SELECT statement is used to retrieve data from a database. The basic syntax is: $ \(SELECT column1, column2, ... FROM table_name;\) $

This query retrieves all columns (*) from the customers table where the country is ‘USA’.

This query retrieves all columns (*) from the customers and orders tables where the customer_id matches.


Martin Gruber Understanding Sql.pdf