Posted by : Anwar Hossain
Category : Basic sql tutorial for Beginner

How to use sql alies for sql table

Dear viewer I will show how to use SQL Allies. SQL Allies are given for rename table column and table name .Generally meaning full Allies names are given for table and table column name so that anyone can understand the table and table column column easily. Most of the SQL Allies are used for aggregate functions column name so that it can be easily understand .Besides at the time of different types of table joining table Column name Allies is very useful.

SQL Allies Example in SQL server

Department Table

Department-table.png

Employee Table

EmployeeTable

SQL Alias Syntax for Table Columns

SELECT column_name1 AS alias_name,

column_name2 AS alias_name,...

FROM table_name;

SQL Statement

SELECT ID, Name as EmployeeName, Age,Email as EmailAddress,
PhoneNumber,HireDate,Salary
FROM Employee;

SQL Statement Result

sql-alies-example-for-column

SQL Alias Syntax for Table Name

SELECT alias_name.column_name,alias_name.column_name, alias_name.column_name

FROM FirstTable AS  alias_name, SecondTable AS alias_name

WHERE alias_name.CommonFirstTableColumn = 'ColumnValue' and alias_name.CommonSecondtableColumn = ColumnValue’

 

SQL Statement

SELECT d.DepartmentName,e.Name,e.Age,e.Email,e.Salary,e.PhoneNumber

FROM Department AS  d, Employee AS e

WHERE d.ID = '1' and e.DepId = '1'

SQL Statement Result

sql-alies-example-for-table.png

SQL Statement for Function

SELECT d.DepartmentName,e.Salary as Total_Production_Deparment_Salery

FROM Department AS  d, Employee AS e

WHERE d.ID = '1' and e.DepId = '1'

SQL Statement Result

sql-alies-example-for-function



Realted Article Headline

How to use MIN () Aggregate Function
How to use MAX () Aggregate Function
How to use SUM () aggregate function
how to use AVG () aggregate function
How to use sql alies for sql table
SQL BETWEEN Operators for retrieving range values
FULL OUTER JOIN using two tables in SQL server
LEFT JOIN using two tables in SQL server
How to join two table in sql server

Article Category

How to create asp.net control dynamically
Learn HTML for beginner
DataList example in C Sharp
Mail sending in asp.net c#
State Management in ASP C #
Basic sql tutorial for Beginner
DataTable example in ASP.Net C#
How to use LINQ in ASP.NET C#
asp.net c # basic tutorial
How to use ajax toolkit in asp.net C#
How to use different types of validation control using asp.net c#
How to use grid view in asp.net c#
Protected by Copyscape Online Plagiarism Detection