Syntax:
To get all columns from a table
SELECT * FROM <Tablename>;
To get particular list of columns from a table
SELECT col1,col2,col3 etc FROM <Tablename>;
Example:
SELECT * FROM EmployeeInfo;
SELECT ID,EmpName,EmpPhone FROM EmployeeInfo;
Result:
Select with alias names:
We can fetch the data from the table by changing the column names run-time. It doesn't impact the original table, but columns would be changed in the result set.
Syntax:
SELECT col1 as <alias name>,col2 as <alias name>,col3 as <alias name> etc FROM <Tablename>;
Example:
SELECT ID as EmpployeeID,EmpName as EmpployeeName,EmpPhone as EmpployeePhone FROM EmployeeInfo;
Result:




SQL Server
C#.Net
ASP.Net
ADO.Net
jQuery
No comments:
Post a Comment