Search This Blog

Thursday, December 23, 2010

1. Three Basics T-SQL Element



In this article we intend that reader with a sense of what is SQL is about , must understand at the basic level of SQL quries. The simplest form of query in SQL asks for those ROWS (tuples) of some one table (relation) that satisfy a condition.

/*                                SIMPLE STATEMENT                            */
/*-----------------------------------------------------------------*/

SELECT * FROM Person.Contact WHERE LastName = 'White';

<Use can copy and paste this query in MS SQL to produce out. You should have AdventureWorks Database>

SELECT statement fetch the rows of the requested columns (* Indicate all column of table (relation)). FROM tell the database to look for the selected table (Person.Contact) and condition clause WHERE restricts rows to LastName  equal to 'White' rest all rows are filtered.
Below is the output with LastName as 'White':


NOTE: All the column are not displayed

Hope you have understood three basic element of T-SQL query.