How to select data from a single table

The syntax for a SELECT statement that gets all columns

SELECT * FROM table-1 [WHERE selection-criteria] [ORDER BY column-1 [ASC|DESC] [, column-2 [ASC|DESC]] ...];

A SELECT statement that gets all columns

SELECT * FROM products WHERE categoryID = 2;

The syntax for a SELECT statement that gets selected columns

SELECT column-1 [, column-2] ... FROM table-1 [WHERE selection-criteria] [ORDER BY column-1 [ASC|DESC] [, column-2 [ASC|DESC]] ...];

A SELECT statement that gets selected columns and rows

SELECT productName, listPrice FROM products WHERE listPrice < 500 ORDER BY listPrice ASC;

Description

Back