Posted inphp / Mysql / Mysqli

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.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype