sql / beginner
Snippet
Renaming Result Columns with AS Aliases
Column aliases assigned via the AS keyword temporarily rename output headers in query results to improve readability without altering underlying table columns.
snippet.sql
sql
1
2
3
4
SELECTfirst_name AS given_name,last_name AS family_nameFROM employees;
Breakdown
1
SELECT
Initiates the column selection for the result set.
2
first_name AS given_name,
Retrieves first_name and renames the output header to given_name.
3
last_name AS family_name
Retrieves last_name and renames the output header to family_name.
4
FROM employees;
Specifies the employees table as the data source.