capypad
0 day streak
sql / beginner
Snippet

Using Column Aliases

Aliases are used to give a table or a column in a table a temporary name. They are often used to make column names more readable or descriptive in the output.

snippet.sql
sql
1
2
SELECT product_name AS item, unit_price AS price
FROM inventory;
Breakdown
1
product_name AS item
Renames the 'product_name' column to 'item' for the duration of the query.
2
unit_price AS price
Renames the 'unit_price' column to 'price' in the result set.