SQL Basics

The Art of Naming: Aliases (AS)

Senior Data Analyst
January 7, 2026
5 min read

The Sunday Cleanup

I was preparing a report for the non-technical staff in the marketing department. When they saw my query output, they looked confused. *"What is 'prod_id_internal_v3'?"* one asked. *"And why is 'ret_price_ex_vat_final' so long?"*

The technical names that made sense to the engineers were gibberish to the business users. I needed to "Translate" on the fly.

The Quest: The User-Friendly Layer

SQL gives us the `AS` keyword (Aliases). It allows us to rename a column or a table only for the duration of that specific query. It doesn't change the database; it just changes the "Label" on the report.

The Implementation: The Translation Layer

I rewrote my query to use "Human" names.

-- Making the column headers pretty

SELECT

prod_id_internal_v3 AS product_id,

prod_name AS name,

ret_price_ex_vat_final AS price

FROM

products;

Why This Matters

1. **Stakeholder Trust**: When a CEO sees a column called "Total Sales," they trust the data more than if it's called `sum_trx_qty_2`.

2. **Shortcuts**: You can use Aliases for tables too (useful for Joins later on!).

3. **Calculations**: When we start doing math (e.g., Price * 0.2), we MUST use an Alias to give that calculation a name.

The "Oops" Moment

I once used spaces in an Alias without knowing I needed double quotes: `AS Product Name`. The query failed.

**Pro Tip**: If you want spaces in your Alis, you need quotes: `AS "Product Name"`. But usually, it's better to use underscores: `product_name`.

The Victory

The marketing team loved the new report. It was clean, readable, and ready to be pasted directly into a presentation. I learned that as an analyst, my job isn't just to fetch data—it's to be a "Bridge" between the machine and the humans.

Your Task for Today

Take a query with obscure column names and use the `AS` keyword to give them clear, descriptive titles.

*Day 8: Unique Voices—Using DISTINCT.*

Ready to put your knowledge into practice?

Join SQL Mastery and learn through interactive exercises.