To list all pairs of student names and course names such that the student takes the course, the relational algebra solution would require that we join the tables STUDENTS, GRADES, and COURSES. In SQL we write:
select distinct STUDENTS.name, COURSES.cname from STUDENTS, GRADES, COURSES
where STUDENTS.stno = GRADES.stno and GRADES.cno = COURSES.cno
This query will return: