var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: SQL Assignment help
I have a question I need to answer for an assignment.
Here is the databse schema:
The question is:
Here is what I have:
Find bars that serve at least one beer liked by Joe, but do not serve any beer liked by
Does this look ok? I am not sure if this enforces the 'at least one beer' constraint.
FROM LIKES L, SERVES S
WHERE L.beer = S.beer AND L.drinker='Joe'
FROM LIKES L , SERVES S
WHERE L.beer = S.beer AND L.drinker='Michael'
that looks okay to me
what happened when you tested it?
I haven't tested it as its a written assignment.
gee, that's too bad
couldn't you just test it anyway?
ok, just tested it in pgAdmin and it seems to work fine. I'll do some more checks now.
If I have to implement a constraint such as the bar has to serve at least 2 beers they like how would I do that?
That's not technically a constraint, it's just a business rule. Constraint has a different meaning in DB-land so it might be confusing to say it that way.
Anywho, have a look at GROUP BY, COUNT and HAVING. You need to use those to satisfy the requirements given.