Views
Create a view for current students:
create view student as
select student_id, name, enroll_date, dept_id
from all_student
where graduation_date is null;
So now:
select s.name
from student s join department d on (s.dept_id = d.dept_id)
where d.name = 'physics'
- Treat student just like a table, for purposes of querying.
The query is expanded to:
select s.name
from all_student s join department d on (s.dept_id = d.dept_id)
where d.name = 'physics'
and s.graduation_date is null
|