SQL TutorialLesson 25Free preview
SQL Aliases
This lesson is part of SQL · All levels
Summary
The alias temporarily names the column or table to make the query results easier to read. For columns, US keywords are optional, while for tables aliases are very helpful in self-joining and naming the results of aggregate functions. The alias only applies to the query results and does not change the original name in the database.
Key points
- The alias column: SELECT price * 1.1 US_new price.
- Table alias: FROM US customers c allows the writing of c.name.
- US keywords are optional for both columns and tables.
- The alias makes the name of the result of the aggregate function more informative, e.g. US total.
- Alias doesn't store anything in the database; it just shows the query results.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.