Retrieving Data with SELECT

The SELECT statement is used to retrieve and filter data from your data source. Listing 3.1 shows the simplified syntax of the SELECT statement. Read from top to bottom, this statement says “select these columns from these tables where these search criteria are true.” You can retrieve several column names from several tables, so long as you separate the column names by commas.

Listing 3.1. The Syntax of the SELECT SQL Statement
SELECT
     column_names
FROM
     table_names
WHERE
     search_conditions

For instance, to retrieve all records from the Employees table, enter the following code in the query manager and press F5 or click the green Play button to execute the query:

SELECT * FROM Employees

This will return every single ...

Get Sams Teach Yourself ADO.NET in 24 Hours 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.