"if you encounter any errors in SAP, send me a screenshot at pramod@learntosap.com, and I will help you resolve the issue."

SQL Aliases

SQL TUTORIALS-

SQL Aliases

Introduction-


Trulli Trulli

-✅SQL Aliases are used to rename columns or tables temporarily in a query for better readability.


Emoji Examples in HTML

🔸 Example Table: Employee


ID Name SALARY DEPARTMENT
1 ANNI 20000 IT
2 SUJAN 25000 HR
3 BOULT 30000 FINANCE
4 POOJA 35000 SALES

✅ Example 1: Column Alias-



SELECT emp_name AS Name, salary AS "Monthly Salary"
FROM employee;

Result Show :-

Result → ANNI | 20000 | SUJAN | 25000 | BOULT | 30000 | POOJA | 35000


💡 Note: The SQL Aliases operator. An alias in SQL is a temporary name given to a column or table to make queries shorter, clearer, or more readable. .

✅ Example 2: Alias with Expression (Calculating Annual Salary)-



SELECT name, salary * 12 AS "Annual Salary"
FROM employee;

Result Show :-

Result → ANNI | 240000 | SUJAN | 300000 | BOULT | 360000 | POOJA | 420000


✅ Example 3: Alias Without AS Keyword-



SELECT name Name, department Dept
FROM employee;


Result Show :-

Result → use an alias without the AS keyword, though it's optional and sometimes discouraged for clarity it.


✅ 4. Table Alias in JOIN-



SELECT e.emp_name, d.dept_location
FROM employee e
JOIN department d ON e.department = d.dept_name;

Result Show :-

Result → e and d are aliases for employee and department tables.


Practice - Yes/No Quiz

1.Can you use SQL aliases without the AS keyword?

2.Is it valid to use an alias in the WHERE clause like this?


May Be Like Important Link-

-How To Import Data(LSMW) LEGACY SYSTEM MIGRATION WORKBENCH

-Define Condition Type-OBYZ

-Genral Ledger Chart Of Accounts-OBD4

-Document 90039783 saved (no accounting document generated)