Querying and Retrieving Data

The SELECT statement is used to query a database and get back the data that matches your query.

The SELECT statement has this general format:

Format of SQL SELECT statement

Additional information

SELECT   Name1  ,Name2  ,Name3 ...     <— can mention one or more columns, or "*" for FROM                             all columns    tablename1, tableName2, ...   <— can mention one or more tables WHERE       conditions                 <— the "WHERE" clause is optional and can ORDER BY  colNames               be omitted ;                                <— the "ORDER BY" clause is optional and can                                  be omitted                                      It returns the data sorted by this field ...

Get Just Java™ 2 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.