Guided Notes

SELECT, WHERE & ORDER BY

Choosing columns, DISTINCT, filtering rows with WHERE and AND/OR/NOT, sorting with ORDER BY, and limiting results with LIMIT.

SELECT and DISTINCT

Slide 1 / 5

SELECT column1, column2 FROM table;

DISTINCT removes duplicate rows from the result: SELECT DISTINCT category FROM products; -- each category once SELECT COUNT(DISTINCT country) FROM customers;

You can also compute values: SELECT name, price * 1.2 AS price_with_tax FROM products;

← Introduction to MySQL