The SELECT statement is at the heart of the SQL language. You use the SELECT statement to retrieve data from one or more tables. Its basic syntax is:
SELECT column-list FROM table-list WHERE where-clause ORDER BY order-by-clause
The SELECT clause specifies what columns you want to retrieve from the table that SQL Server returns to the recordset. The basic syntax for a SELECT clause is:
The simplest SELECT clause looks like this:
This SELECT clause retrieves all columns from a table. Here's another example that retrieves only the CustomerID and CompanyName columns from a table:
SELECT CustomerID, CompanyName
Not only can you include columns that exist in your table, but ...