An alias gives a column or table a temporary name, making results and queries easier to read.
Column: SELECT CustomerName AS Customer
Use quotes for names with spaces: AS "Contact Person"
Table: FROM Customers AS c, then refer to c.City. Very common in joins.
💡 Key Takeaways: SQL Aliases
Mastering SQL Aliases helps you write clean and reliable SQL code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.
SQL Aliases Code Example
SQL
SELECT CustomerName AS Customer,
ContactName AS "Contact Person",
City || ', ' || Country AS Location
FROM Customers AS c
WHERE c.Country = 'Pakistan';
Free sign-in required · Google login available
SQL Aliases Practice Exercises
Check what you learned in “SQL Aliases”.
/ 3 solved
Fill in the blank
Rename the column in the result.
SELECT CustomerName Customer FROM Customers;
✓ Correct!Not quite. Try again.
Multiple choice
Aliases are…
✓ Correct!Not quite. Try again.
Code challenge
Select ProductName as Item and Price as Cost from Products where ProductID = 1.
Write the code in the live editor. Your answer is checked automatically.