Recall & Review
beginner
What is a table alias in SQL?
A table alias is a temporary name given to a table in a query to make it easier to reference, especially when using joins or long table names.
Click to reveal answer
beginner
How do you assign an alias to a table in a SQL query?
You write the table name followed by the alias name, usually separated by a space. For example:
FROM employees e assigns the alias e to the employees table.Click to reveal answer
beginner
Why use table aliases in SQL queries?
Table aliases make queries shorter and easier to read. They help when joining multiple tables by clarifying which table each column belongs to.
Click to reveal answer
beginner
Can table aliases be used in the SELECT clause?
Yes, once a table has an alias, you use that alias to refer to its columns in the SELECT clause and elsewhere in the query.
Click to reveal answer
beginner
Is the alias name permanent in the database?
No, aliases only exist for the duration of the query. They do not change the actual table names in the database.
Click to reveal answer
What does this SQL snippet do? <br>
SELECT e.name FROM employees e;✗ Incorrect
The 'e' after employees is a temporary alias used to refer to the employees table in this query.
Why are table aliases useful in queries with multiple tables?
✗ Incorrect
Aliases help clarify which table each column belongs to, especially in joins.
Which of these is a correct way to alias a table?
✗ Incorrect
The correct syntax uses AS or just a space to assign an alias.
If you alias a table as 'c', how do you select the column 'city' from it?
✗ Incorrect
You use the alias followed by a dot and the column name.
Do table aliases affect the actual table names in the database?
✗ Incorrect
Aliases are temporary and only exist while the query runs.
Explain what a table alias is and why it is useful in SQL queries.
Think about how you might shorten a long name to make talking easier.
You got /4 concepts.
Describe how to write a SQL query that uses a table alias and how to refer to columns using that alias.
Remember the format: FROM table AS alias
You got /4 concepts.