Alias
Discover how to apply aliases to columns and tables in SQL to write cleaner, more understandable queries. This lesson helps you use aliases for functions, sorting, grouping, and multiple table references, preparing you for more advanced SQL operations.
We'll cover the following...
Alias
Aliases are like nicknames, a temporary name given to a table or a column to write expressive and readable queries. We can use aliases with columns, tables, and MySQL functions.
Example Syntax
SELECT col1
AS aliasCol1
FROM table;
Connect to the terminal below by clicking in the widget. Once connected, the command line prompt will show up. Enter or copy and paste the command ./DataJek/Lessons/20lesson.sh and wait for the MySQL prompt to start-up.
-
We have the first name column in the Actors table. Since most actors are known by their first names, we can alias the FirstName column as PopularName in the following ...