MySQL: Alias for Columns

Profile picture for user arilio666

During querying in MySQL to make the column name more readable and understandable there is an option of naming the column in our term this is called aliasing in MySQL. This aliased name is only present upon the duration of the query execution and will not make a permanent change in the column name.

Syntax

SELECT ColumnName AS ReadableName FROM TableName;

Here AS is used to alias the column name to our readable name.

For example purpose, we will be using the employees' table and we will be aliasing the job title and first name column to represent more readable like Employee and Designation.

Here is the employees' table.

Example

select job_title AS Designation,first_name AS Employee from employees;

  • So from this, we have taken the 2 columns job_title and first_name to alias the following columns to make them more readable and understandable.
Tags