Support us .Net Basics C# SQL ASP.NET ADO.NET MVC Slides C# Programs Subscribe Buy DVD

Select statement - Part 10

Basic select statement syntax
SELECT Column_List
FROM Table_Name

If you want to select all the columns, you can also use *. For better performance use the column list, instead of using *.
FROM Table_Name

To Select distinct rows use DISTINCT keyword
FROM Table_Name

Example: Select distinct city from tblPerson

Filtering rows with WHERE clause
SELECT Column_List
FROM Table_Name
WHERE Filter_Condition

Example: Select Name, Email from tblPerson where City = 'London'

Note: Text values, should be present in single quotes, but not required for numeric values.

Different operators that can be used in a where clause


  1. how using columnlist would be faster than using * in the select query

    1. 1.* reteives all columns even though some of the columns are not requred,it causes performance degadation,time consuming.
      2. In future if we want to change any column alias names while retriving, it is difficult. in that time we must specify thespecified columns.

  2. Thank you Mr. Venkat for providing all your tutorials. Now I have a better understanding of SQL.

  3. how to fetch values row wise instead of column wise suppose i have 23 colums i want 1st column's each cell value separately on webpage with single statement


If you like this website, please share with your friends on facebook and Google+ and recommend us on google using the g+1 button on the top right hand corner.