Help to translate SQL query to Relational Algebra

Posted by Mestika on Stack Overflow See other posts from Stack Overflow or by Mestika
Published on 2010-03-12T17:05:02Z Indexed on 2010/03/12 17:07 UTC
Read the original article Hit count: 465

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

© Stack Overflow or respective owner

Related posts about sql

Related posts about relational