Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have been asked to outline the sequence of commands using low-level operators (join/project/select) that are used in the following SQL statement;

SELECT d.name, k.city
FROM DOG d, KENNEL k
WHERE d.kennel_name = "Holiday Kennels"
AND d.kennel_name = k.name;

My understanding would be you would project d.name and k.city like this;

PROJECT d.name, k.city

However beyond this I am unsure how you would use join and select to get the clauses?

Any help would be great, thanks.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I assume you're talking about Relational Algebra here.

A SELECT operation returns whole tuples (rows) based on some predicate. The predicate is defined in the SQL statement by the WHERE clause.

The PROJECT algebra operation is where you select a subset of attributes from each tuple. The PROJECT operation is defined in the SQL statement by the columns you specify. In SQL, the SELECT and PROJECT operations are combined into the SELECT clause.

A JOIN operation is used to combine two sets of tuples by a common and related attribute. In this example, you are using an INNER JOIN defined in the FROM and WHERE clause. I generally prefer to declare my joins solely in the FROM clause, but it works either way.

So, the SELECT operation is:

WHERE d.kennel_name = "Holiday Kennels"

The PROJECT operation is:

SELECT d.name, k.city

And the JOIN operation is:

FROM DOG d, KENNEL k
...
AND d.kennel_name = k.name;
share|improve this answer
    
So here we could say; PROJECT (using d.name, k.city) SELECT (using d.kennel_name) AND JOIN (using d.kennel_name, k.name) –  RJones Apr 4 at 14:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.