# Miscellaneous > General Database Discussions >  Relational Algebra

## bobFROMaccount

Given : LIKE(person, course), TAKING(person, course), and DISLIKE(person, course). Also assume that a person likes at least one course and dislike at least one course as well. We also assume that a course is taken by at least one person.
*
List the people that are taking all the courses they like. Express in relational algebra.*

I've spent a long time looking at this problem and cannot figure it out. I realize if there was one person, I can easily find most questions that ask "all" but in this case, I cannot figure it out because it is more than one person.

----------


## Gil-Galad

Just to understand you clearly, LIKE , TAKING, DISLIKE are tables? person and course are varchars?

----------


## bobFROMaccount

Yes, they are tables. It does not matter whether they integer or varchars, the answer is wanted in relational algebra.

----------


## Gil-Galad

How about this, does use a view though.



```
CREATE VIEW [nonlikes]
AS
SELECT person,course FROM taken
EXCEPT
(SELECT person,course FROM taken 
INTERSECT
SELECT person,course FROM likes)   

SELECT DISTINCT person FROM taken except
SELECT DISTINCT person FROM nonlikes
```

----------


## bobFROMaccount

Gil-Galad, thanks for the help but that is not in relational algebra.

----------


## jorgea

Can you better explain what you are asking?  It is a little unclear what exactly you want.

----------


## crodriguez08

Perhaps something like this?

πT.person(Likes⋈Taking⋈Dislikes)/πT.person(Likes⋈Taking)

It might require a -πT.person(Dislikes⋈Taking) but am not entirely sure as I am not exactly an expert at this.  Hope it helps though.  :Smilie:

----------

