|
Current Topic: View Topic Tree |
Everything > Science & Technology > Computers > Programming > SQL |
|---|
|
|
one or more field names |
|
|
a database name |
|
|
a conditional clause that specifies rows |
|
|
a table name |
|
|
a function for sorting data |
In the SQL database language, one or more field names (column names) must follow the SELECT keyword in a SELECT statement?
The SELECT statement is the only means for querying a database, in the SQL language. The act of querying a database simply means getting the particular data that you want out of it. For example, suppose you want to phone a friend but you don't know his number. You must 'query' the phone book for his phone number by using his name as a means for lookup.
If the phone book were a database table, it would consist of many rows, one for each person in the phone book. And, it would have at least two fields for each row, where the fields are just columns in the table: one column for each person's name and another column for each person's phone number. Querying the database would amount to finding the row with your friend's name, and then getting the associated phone number in that same row.
Let us assume there is such a table, called phone_book, which has two fields called name and phone_number. Let us further assume that your friend's name is John Doe. The query to find your friend's phone number might look something like this:
SELECT phone_number FROM phone_book WHERE name='John Doe'
Obviously, the SELECT clause in a SELECT statement expects a field name to identify the piece of data you wish to access. In this case, you only wish to access the single field containing your friend's phone number, after the particular row has been identified by the WHERE clause.