|
    |
|
|
TSQL SELECT Tutorial
Introduction The SELECT statement is used for retrieving data from a table. This SQL Statement begins with the keyword SELECT. The results from the SELECT query is called the 'Result set'. The SELECT Statement has two basic parts: * SELECT * FROM following the 'SELECT' keyword will be the columns to be selected following the 'FROM' keyword will be the table to be selected from. Beginning Example This example will select the 'Name', 'Position' and 'Salary' columns' content from the 'Employees' table. Note: This example selects all of the records from the table. SELECT Name, Position, Salary FROM Employees Here is a sample result set from the above SELECT query: Name Position Salary Joe Grape Manager 80000 John Plum Software Developer 65000 Frank Apple Software Developer 62000 Patty Pineapple Software Developer 60000 Judy Peach Software Developer 50000 Jane Orange Project Manager 75000 Selecting ALL Columns - * Previously we selected columns by specifying the column names. By using the * symbol, we can select all the columns from a table In this example we will assume that the 'Employees' table contains the follow columns: 'Name', 'Position', 'Office' and 'Salary'. SELECT * FROM Employees Here is a sample resultset from the above SELECT query: Name Position Office Salary Joe Grape Manager Houston 80000 John Plum Software Developer Houston 65000 Frank Apple Software Developer Cleveland 62000 Patty Pineapple Software Developer Cleveland 60000 Judy Peach Software Developer Boston 50000 Jane Orange Project Manager Houston 75000 Limiting Rows - WHERE clause The WHERE clause acts as a filter on the result set. By adding a WHERE clause after the FROM keyword, the result set can be limited to rows that meet particular conditions. This example will select the 'Name', 'Position' and 'Salary' columns' content from the 'Employees' table, where the employee's Position is 'Manager'. SELECT Name, Position, Salary FROM Employees WHERE Position = 'Manager' Here is a sample result set from the above SELECT query: Name Position Salary Joe Grape Manager 80000 This example will select the 'Name', 'Position' and 'Salary' columns' content from the 'Employees' table, where the employee's Salary is greater than 61,000. SELECT Name, Position, Salary FROM Employees WHERE Salary > 61000 Here is a sample result set from the above SELECT query: Name Position Salary Joe Grape Manager 80000 John Plum Software Developer 65000 Frank Apple Software Developer 62000 Jane Orange Project Manager 75000 Read full post here: TSQL SELECT Tutorial |
|
 |
|
PLEASE VISIT THE CONTRIBUTOR'S WEBSITE
No reactions yet.
Please login or sign up to rate this intel.
Please login or sign up to add a comment.
The copyright for this content entitled "TSQL SELECT Tutorial" has been specified by the contributor as:
All Rights Reserved
This content may not be copied, distributed or adapted by anyone under any circumstances.
|
 |
May, 2012
2008
January, February, March, April, May, June, July, August, September, October, November, December
2009
January, February, March, April, May, June, July, August, September, October, November, December
2010
January, February, March, April, May, June, July, August, September, October, November, December
2011
January, February, March, April, May, June, July, August, September, October, November, December
2012
January, February, March, April, May
|
|
Not a member yet?
Qondio is a powerful network for making it online. If you have a website to
promote, we can help.
Sign up and get in on the action.
|
|
Welcome to Qondio! Discover the awesome power this network can deliver by going to our About page. Or you could skip straight to the Sign Up form.
|
|