Select statement in MS sql server

 


SELECT Column_List

FROM Table_Name


If you want to select all the data(column), you can also use (* ) For better performance use the column list, instead of using (*.)

SELECT * FROM Table_Name


To Select distinct rows use DISTINCT keyword

SELECT DISTINCT Column_List 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 tblemployee where City = 'London'


Note: Text values ​​must exist in single quotes, but are not required for numeric values.