Question · SQL and MySQL course · Module 7: Joining tables (JOIN)
Why two aliases in a self-join
Why, in a self-join, do we give the same table two different aliases (e.g. a1 and a2)?
Answer options
- Because otherwise the query sorts the result descending
- So that MySQL knows which copy of the table is meant in the ON clause and in SELECT
- To permanently rename the table
- To skip the ON clause
You can check the correct answer by solving this task in the CodeWorlds game.