Help to translate SQL query to Relational Algebra
- by Mestika
Hi everyone,
I'm having some difficulties with translating some queries to Relational Algebra. I've a great book about Database Design and here is a chapter about Relational Algebra but I still seem to have some trouble creating the right one:
Thoes queries I've most difficuelt with is these:
SELECT COUNT( cs.student_id ) AS counter
FROM course c, course_student cs
WHERE c.id = cs.course_id
AND c.course_name = 'Introduction to Database Design'
SELECT COUNT( cs.student_id )
FROM Course c
INNER JOIN course_student cs ON c.id = cs.course_id
WHERE c.course_name = 'Introduction to Database Design'
and
SELECT COUNT( * )
FROM student
JOIN grade ON student.f_name = "Andreas"
AND student.l_name = "Pedersen"
AND student.id = grade.student_id
I know the notation can be a bit hard to paste into HTML forum, but maybe just use some common name or the Greek name.
Thanks in advance
Mestika