alias in sql

Today, We want to share with you alias in sql.In this post we will show you how to join two tables with alias, hear for sql alias in where clause we will give you demo and example for implement.In this post, we will learn about sql server alias with an example.

how to use alias column name in where clause mysql

In this tutorial we learn to all about aliash in sql Examples like as a for Columns, table, with aggregate functions or many more.
Also Read: sql join multiple tables

SQL Alias for Columns Examples

SELECT MemberID AS ID, MemberName AS Member
FROM Members;

Alias for Tables Example

SELECT o.OrderID, o.OrderDate, c.MemberName
FROM Members AS c, Requets AS o
WHERE c.MemberName='Around the Horn' AND c.MemberID=o.MemberID;

SQL Examples

SELECT C.Id AS Identifier, C.LastName + ', ' + C.FirstName AS MemberName, 
       SUM(O.TotalAmount) AS TotalSpent
  FROM [Order] O JOIN Member C ON O.MemberId = C.Id
 GROUP BY C.Id, C.LastName + ', ' + C.FirstName
 ORDER BY TotalSpent DESC

SQL Server table alias

SELECT
    vendors.customers.customer_id,
    profile_name,
    sir_name,
    order_id
FROM
    vendors.customers
INNER JOIN vendors.orders ON vendors.orders.customer_id = vendors.customers.customer_id;

with aggregate functions

SELECT COUNT(MEMBER_ID) AS MemberCount, C.MEMBER_CITY AS Location
  FROM MEMBER C
GROUP BY C.MEMBER_CITY

I hope you get an idea about alias in Mysql.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment