I am new to programming and I am teaching myself ORACLE sql with a textbook from home. I was wondering if anyone could provide me with an explanation for why this script doesn't work. I have been able to do it alternate ways and get the answer but I just want to understand the fundamentals of why I am not able to alias an inline view. Thanks.
SELECT * FROM
(
(SELECT * FROM SECTION WHERE INSTRUCTOR='HERMANO') s
JOIN Grade_report g
ON s.section_ID=g.section_id
) v
JOIN Student Stu
ON stu.stno=v.student_number
Returns:"SQL command not properly ended"
Table Grade_report has columns: section_number, section_ID, Grades;
Table Student has columns: stno (student number);
Table Section has columns: section_ID, Instructor;
It doesn't work, because the part that you are trying to give the alias
v
isn't a valid query:You could make it valid by adding an extra select inside that snippet:
Or you can just remove that alias altogether and have two joins on the same level:
Which is essentially the same as: