Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL query .. please!

Author  Topic 

hero
Starting Member

1 Post

Posted - 2010-04-30 : 16:16:58
Hello everybody, hello Dani!

I'm doing my homework of 'Data Base', exactly in the chapter: Relational Algebra, here I am, I can't find a specific relation (or the SQL corresponding query) !

Here the schema:

MEAL(guest,date);
MENU(dish,date);
PREFERENCE(person,dish);

I wanna find the SQL query (or the relation in Relational Algebra):"the guests who attended to every dish".

I'm semi-sure that we must use the division operation, but how?

This my try in relational algebra(I'd like to know the SQL corresponding query):

R1:JOIN(MEAL,MENU);
R2:PROJECT(R1,guest,dish);
R3:PROJECT(R1,dish);
R4:DIVISION(R2,R3);
Or how .. I need help
I hope find a solution or a lil hint!
Greeting!

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-05-01 : 00:29:05
group on the person and take the distinct count of dish. this should be equal to distinct count of dish in dish table.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -