This comma- separated list column names from the database
592 APPENDIX C ■ SQL PRIMER
• A table returned into a DataSet via a DataAdapter’s Fill() method
• A set of results returned from a SqlDataSource
The syntax of the SELECT query looks like this:
SELECT <select column list>
FROM <table>
[ <join expression> ]
[ WHERE <constraints> ]
[ ORDER BY <order column list> ]
This query has the following five pieces:
• A select column list to be retrieved from the database. Generally, this is a comma- separated list of column names from the database, the * wildcard (meaning every column in the given table should be returned), or an aggregate function on a set of columns such as COUNT() or TOP().For example, to retrieve the names of all the family members in a genealogy database, use the following query:
SELECT MemberName FROM familymember
If you want to retrieve all the details about the dogs in the family, use the following query: SELECT * FROM familymember
WHERE MemberSpecies = 'dog'
To retrieve the Social Security number for every member of the family born before 1987, use the following query:
SELECT familymember.MemberName, financialdetail.SSN
FROM familymember
INNER JOIN financialdetail
ON financialdetail.MemberID = familymember.MemberID
WHERE MemberBirthdate < '01/01/1987'APPENDIX C ■ SQL PRIMER 593
• The optional (comma-separated) column list that names the columns in the new row to which you’re giving values. This list must be surrounded by parentheses.
• The keyword VALUES that separates the column list from the column value list.