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 the following tables;

DOG    +----------------------------------------------+
       | Name   Type     Age Kennel_name  Owner_name  |
       +----------------------------------------------+
       | Rover  Labrador 4   Bidawee      Smith       |
       | Lassie Alsatian 3   Rescue Dogs  Jones       |
       +----------------------------------------------+

OWNER  +------------------+
       | Name  City       |
       +------------------+
       | Smith Lancaster  |
       | Jones Nottingham |
       +------------------+

KENNEL +-----------------------+
       |   Name        City    |
       +-----------------------+
       | Bidawee     Preston   |
       | Rescue Dogs Sheffield |
       +-----------------------+

I am struggling to understand what the following would do to these tables;

i) select (using DOG)
ii) project (using DOG)
iii) Cartesian product (using DOG and OWNER)
iv) join (using DOG and OWNER)

My understanding is that;

i)   Would simply produce the DOG table again.
ii)  Would produce the DOG table again but ensure there are no duplicate values in the resulting table.
iii) Would produce a table where every value of DOG also ties up to Owner
iv)  I am unsure really what join would do here, would it simply just join DOG and Owner together and add the Name and City fields from OWNER onto the end of DOG?

Could somebody please explain these a bit further and correct me if I have any of them wrong?

Thanks

share|improve this question
    
Your understanding seems mostly correct. i) two rows, 5 columns. ii) it depends on the desired attributes, which you haven't provided. iii) 4 rows, 7 columns. iv) the join would happen on dog.owner_name and owner.name presumably and the result would be 2 rows, 7 columns. Is this a homework problem for relational algebra or database design? I'm wondering if that's why your question is abstract instead of tied to a specific technology. –  efesar Apr 4 at 14:58
    
It's actually revision for a database exam, thanks for the answers :) I guess for ii) If the attributes aren't desired, we simply project the DOG table again minus any repeating values should there be any? –  RJones Apr 4 at 15:08
    
According to my old database design text, "project produces a subset of the columns ... Project uses a list of column names to indicate the columns to retain in the output ... Project: an operator that retrieves a specified subset of the columns of the input table." So to me, that means you need a column list, and without it, then it's the same as the select operator. –  efesar Apr 4 at 15:37

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.