0
Student (student_id, student_name, year, GPA)
Course (course_id, course_name, credits, dept_id )
Enroll (student_id, course_id, mark, grade)
SELECT stu.student_name FROM Student AS stu, Enroll AS enr
WHERE stu.student_id = enr.student_id AND enr.course_id = "SCS1008" AND enr.mark < 80
ORDER BY stu.student_name; 

There use Stu.Student_name.

I want to know from where the stu has come and without any attribute as stu, how to use it.

Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

1

It's an alias for the Student table, by virtue of Student AS stu. The alias stu allows you to reference the Student table by using a shortened name elsewhere in the query. It is short for Student.Student_Name, that being the Student_Name field on the Student table.

cf_en
  • 1,661
  • 1
  • 10
  • 18
  • It is worth to mention, that aliases become a necessity when you have to join a table to itself. Aliases in this case allows you to distinguish between the two instances of the same table. – Pred Nov 08 '17 at 12:56