BASEWEBMASTER

Brought To You By
Tomlin Ventures Ltd

SELECT Statement

Using the SQL SELECT statement

The select statement is probably the most common SQL query you will use as a webmaster. As you may have already guessed it is used to extract or select data from a database table.

Various parameters may be added to the select statement to limit or filter the returned data in some way, we will cover these over the following pages.

In its simplest form the select statement will be arranged like this.

SQL
SELECT * from table_name

This will return all data from the table table_name. The asterix is used to select all columns in the table.

Selecting Only Specific Columns

Now it may be that you do not want to return all columns from this table, you may wish to limit the columns to only those specified, this can be done with.

SQL
SELECT col_one, col_two, col_three from table_name

Where col_one, col_two and col_three refer to the specific columns that you wish to return.

That is the Select statement, in its simplest form at least. It is with this statement that you will select the required data from your database to present on your webpages.

Hit the next article below to see how we can start to add to this statement and filter the data before returning.

Share to Facebook Share to Twitter Digg This Stumble It Share to Reddit Share to Delicious Technorati LinkedIn Google Buzz Blogger More...

blog comments powered by Disqus