b_book1.gif (162 bytes) Database

SQL - Select statement

SQL is a "Non Procedural Language". That means that there is little or no meaning in the order of statements.

SELECT column1, column2, .....
                    *
{Output}
{Selects the whole row}
FROM table1, table2, .... {Input}
WHERE conditions ... {Row Selection Conditions}
GROUP BY ....
              HAVING .....
{Condenses the data set}
ORDER BY ... {Sort on a column}

Examples of SQL Select.

a97v_crc.gif (4207 bytes)
  • SELECT CustId, Address
    FROM Customer
    WHERE Customer.Discount > 10;
  • To list all fields and records in the fruit table
    SELECT * FROM fruit;
  • To list the Fruit_id and Fruit_name
    SELECT Fruit_id, Fruit_name FROM fruit;
  • To count the number of fruit types
    SELECT COUNT(*) FROM Fruit;

[Rev: 25/8/98] 27 Mar 97 © 1997 V/2-Com (Verhaart), P O Box 8415, Havelock North, New Zealand.