SQL Aliases

SQL Aliases are temporary names assigned to tables or columns for the duration of a query. They are used to […]

SQL Aliases are temporary names assigned to tables or columns for the duration of a query. They are used to simplify complex queries, improve readability, and provide clarity when dealing with multiple tables or when the original names are lengthy.

SQL Aliases Syntax

SQL



Tutorials dojo strip

SQL Aliases Basic Example

This query selects the first_name and last_name columns from the Patients table and assigns user-friendly aliases “First Name” and “Last Name” for clearer output.

SQL



SQL Aliases Alias for Columns Example

In this query, table aliases (d for Doctors, a for Appointments, p for Patients) streamline the selection of doctors’ and patients names while improving clarity in the output with descriptive aliases.

SQL




SQL Aliases Combining Aliases Example

This query combines data from Students and Patients using aliases to provide a clear output of “Student Name” and a concatenated “Patient Full Name” while illustrating their assumed relationship.

SQL




SQL Aliases Visual Diagram




SQL Aliases Labs

Tutorials dojo strip