MESSAGE
DATE | 2014-12-10 |
FROM | Ruben Safir
|
SUBJECT | Subject: [LIU Comp Sci] HW 6
|
From owner-learn-outgoing-at-mrbrklyn.com Wed Dec 10 23:58:51 2014 Return-Path: X-Original-To: archive-at-mrbrklyn.com Delivered-To: archive-at-mrbrklyn.com Received: by mrbrklyn.com (Postfix) id AAEB3161162; Wed, 10 Dec 2014 23:58:51 -0500 (EST) Delivered-To: learn-outgoing-at-mrbrklyn.com Received: by mrbrklyn.com (Postfix, from userid 28) id 73230161166; Wed, 10 Dec 2014 23:58:51 -0500 (EST) Delivered-To: learn-at-nylxs.com Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89]) by mrbrklyn.com (Postfix) with ESMTP id D1ED9161162 for ; Wed, 10 Dec 2014 23:58:49 -0500 (EST) Received: from [10.0.0.42] (unknown [96.57.23.82]) by mailbackend.panix.com (Postfix) with ESMTPSA id 7351A13CA8; Wed, 10 Dec 2014 23:58:48 -0500 (EST) Message-ID: <5489248F.2020505-at-panix.com> Date: Wed, 10 Dec 2014 23:58:55 -0500 From: Ruben Safir User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: learn-at-nylxs.com, Ping-Tsai Chung , "ptchung-at-ieee.org" , "pingtsaichung-at-gmail.com >> Ping-Tsai Chung" Subject: [LIU Comp Sci] HW 6 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: owner-learn-at-mrbrklyn.com Precedence: bulk Reply-To: learn-at-mrbrklyn.com
With regard to Problem 1E in the homework What is this? This can't be right. I don't know what is right, but this aint it.
In order to do this as division the divisor has to be a SUBSET of of the numerator. (e) Retrieve the names of employees who work on every project. PROJ_EMPS(PNO,SSN) ? ? PNO,ESSN (WORKS_ON) ALL_PROJS(PNO) ? ?PNUMBER (PROJECT) EMPS_ALL_PROJS ? PROJ_EMPS รท ALLPROJS RESULT ? ? FNAME,MINIT,LNAME (EMPLOYEE * EMP_ALL_PROJS) RESULT: No Data Found.
To quote the text, and this is honestly a weird operation
Produces a relation R(X) that includes all tuples t[X] in R1(Z) that appear in R1 in combination with every tuple from R2(Y), where Z = X ? Y.
That means Y MUST BE a SUBSET of Z...
We are trying to find the one the single individal who is all in ALL the project, and all the other individual lke him.
I have no idea how to solve this.
In general set theory terms,
we want
Inviduals who's Set of pno is equal to the set of pnumbers in the works_on table
You can get the sets?
? pno (sigma essn = SSN (works_on))
where each SSn is in the set of ? ssn (employee)
where the set of pno is complete.
Don't ask me how to express this. I have no idea and don't see it in the books or on line.
FRANKLY, this problem is not done with relational agrebra. This is where you DITCH SQL and use a peal loop. I don't know of any way of doing conditional looping in set theory.
You might be able to compare to sets, but that is not covered in the book here.
In sql I would use count
select employee.ssn from employee, works_on where employee.ssn = works_on.essn having count( works_on.essn) == subquery( select count (pnumber) from works_on )
That might not be legl either. I don't think you can put a count in a having without a group by claus?
Ruben
Anyway - I am Ccing Dr Ping on this. Maybe he can shed light on this
|
|