SQL Server Tutorial
SQL Server provides the SELECT statement to access and retrieve data from a database.
SELECT statement prompts the SQL Server to query a single table or multiple tables in the database.
SELECT query results are displayed with the column names as the column names specified in the table at the time of its creation.
Column headings also need to be assigned to the computed columns in the SELECT statement.
Two different methods are available in SQL Server to provide user-defined column headings.
SELECT statement to retrieve the specific columns with user-defined columns heading from a single table.
SELECT column_heading1 = column_name1 [, column_heading2 = column_name2, ...] FROM table_name
SELECT column_name1 column_heading1 [, column_name2 column_heading2, ...] FROM table_name
here column_heading is the user-defined column heading and column_name is the name of the column in the database table.
SELECT 'Employee ID'=Id, 'Employee Name'=Name, 'Department Id'=DeptId, 'Employee Email'=Email FROM EmployeeOutput:
SELECT Id 'Employee ID', Name 'Employee Name', DeptId 'Department Id', Email 'Employee Email' FROM EmployeeOutput:
SELECT Id 'Employee ID', Name 'Employee Name', DeptId='Department Id', Email 'Employee Email' FROM EmployeeOutput:
SELECT Id 'Employee ID', Name 'Employee Name', 'Department Id' DeptId , Email 'Employee Email' FROM EmployeeOutput:
SQL Server Tutorial
Privacy Policy | Copyright2020 - All Rights Reserved. | Contact us | Report website issues in Github | Facebook page | Google+ page