Skip
Arish's avatar

168. Column Aliases in JOINs


Avoiding Ambiguity

When both tables have same column name:

sql
1SELECT 
2  s.id AS student_id,
3  s.name,
4  c.id AS course_id,
5  c.course_name
6FROM students s
7INNER JOIN courses c ON s.course_id = c.id;