In the previous example, we created a new column that was a calculated value. The problem is that the column header is now population / SurfaceArea. However, we can rename the column header to something cleaner by creating a column alias. Look at the code snippet below.
Example:
SELECT name, population / SurfaceArea
AS “People per square mile”
FROM country;
We used the AS keyword then in quotes we put the new column alias of “People per square mile.” Which changes the column header as seen show below.
Results:
This content is provided to you freely by BYU-I Books.
Access it online or download it at https://books.byui.edu/learning_mysql/column_aliases.