Challenge - 5 Problems
Column Alias Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate2:00remaining
Output of column alias in SELECT
What is the output of this SQL query?
Assume the employees table has these rows:
SELECT first_name AS name FROM employees;
Assume the employees table has these rows:
first_name John Jane Bob
SQL
SELECT first_name AS name FROM employees;
Attempts:
2 left
💡 Hint
The AS keyword renames the column in the output.
✗ Incorrect
Using AS changes the column header in the result to the alias name.
❓ query_result
intermediate2:00remaining
Multiple column aliases in SELECT
What is the output of this SQL query?
Assume employees table rows:
SELECT first_name AS fname, last_name AS lname FROM employees;
Assume employees table rows:
first_name | last_name Alice | Smith Bob | Brown
SQL
SELECT first_name AS fname, last_name AS lname FROM employees;
Attempts:
2 left
💡 Hint
Each column alias changes the column header separately.
✗ Incorrect
Both columns are renamed in the output using AS.
📝 Syntax
advanced2:00remaining
Identify the syntax error with AS alias
Which option contains a syntax error when using column alias with AS?
Attempts:
2 left
💡 Hint
AS must be followed by a valid alias name.
✗ Incorrect
Option C misses the alias name after AS, causing syntax error.
❓ query_result
advanced2:00remaining
Effect of alias on ORDER BY clause
What is the output order of this query?
Employees table:
SELECT first_name AS name FROM employees ORDER BY name DESC;
Employees table:
first_name Anna Zack Mike
SQL
SELECT first_name AS name FROM employees ORDER BY name DESC;
Attempts:
2 left
💡 Hint
Aliases can be used in ORDER BY to sort results.
✗ Incorrect
The query orders by the alias 'name' in descending order.
🧠 Conceptual
expert2:00remaining
Why use column aliases with AS?
Which is the best reason to use column aliases with AS in SQL queries?
Attempts:
2 left
💡 Hint
Think about what aliases affect: output or schema?
✗ Incorrect
Aliases only rename columns in the query result, not the table.