Search This Blog

Wednesday, October 27, 2010

SQL database queries basic question

Programmer Question

Relational Schema:




  • Employee (Enum, Ename)

  • VentingMac (Enum, Cokename, day)



The attribute Enum in VentingMac relation is a foreign key referencing the relation Employee.



I want to list out all the employee names (Ename), who drink more than 3 (distinct) coke on the same day
(assuming they wont drink the same coke each day)



note I cant use any build-in or aggregating function.
I have no idea how i can "count" them without using functions. I am thinking maybe I could do 3 subQuery but I cant seem to get it to work.



Find the answer here

No comments:

Post a Comment

Related Posts with Thumbnails