How to select rows
The syntax of the SELECT
statement
SELECT select_list
FROM table_source
[WHERE search_condition]
[ORDER BY order_by_list]
Retreiving all rows (records)
SELECT * FROM products
The result set
Retreiving three (3) columns (fields) and sorting by price
SELECT productID, productName, listPrice
FROM products
ORDER BY listPrice;
The result set
Retreiving rows in a price range
SELECT productID, productName, listPrice
FROM products
WHERE listPrice < 450
ORDER BY listPrice;
The result set
Retreive an empty result set
SELECT productID, productName, listPrice
FROM products
WHERE listPrice < 10;
Output
MySQL returned an empty result set (i.e. zero rows). (Query took 0.0003 seconds.)
Back