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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.