Tsallaka zuwa abun ciki
Justice Tech School

Aliases

AS gives a column or table a temporary name. Aliases make results easier to read and long table names easier to type, which matters a lot in joins.

Example
SELECT name AS student, score AS points
FROM students
WHERE id <= 2;

Result

student | points
Ada     | 92
Kofi    | 78
Example
SELECT s.name, s.country
FROM students AS s
WHERE s.id = 3;

Result

name  | country
Amina | Nigeria

Exercise

Rename the column in the result.

SELECT name  student FROM students;

Quiz Test

Does an alias change the real column name in the table?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.