Suppose you had the following table, named Customers, in a database somewhere:
CustomerID
CustName
CustAddr
CustPhone
101
Bob Jones
3464 N. Canterbery S.
(425) 777-1267
102
Darcy Devins
121 State St.
(317) 676-8453
105
Clide Shambles
323 N. 64th
(765) 222-3333
The general form of the SELECT statement is as follows:
SELECT <columnName>
FROM <tableName>
[ WHERE <tuple condition>
GROUP BY <Non-Aggregate columnNames>
HAVING <Aggregate condition>
ORDER BY <columnName> ];
Using this notation, to SELECT everthing in the Customers table:
SELECT * FROM Customers;
This query will return the table at the top of the page.
Using the above notation, to SELECT the Customer name whose CustomerID=102
(assuming the field CustomerID is an Integer):
SELECT CustName FROM Customers WHERE CustomerID=102;
If the field CustomerID is a char:
SELECT CustName FROM Customers WHERE CustomerID='102';
Either of these queries will return the following table: