Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Lennart Jonsson Newsgroups: comp.databases.ms-sqlserver Subject: Re: Sql question Date: Mon, 02 Feb 2015 08:45:09 +0100 Organization: A noiseless patient Spider Lines: 42 Message-ID: References: <1f5aad6b-a99e-48c3-adde-5f72eea5793b@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 2 Feb 2015 07:44:35 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="5f53882e1b0b5de864e88de647f19c93"; logging-data="23171"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+L7Wu7QdGMsvU60e28VX1v" User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 In-Reply-To: <1f5aad6b-a99e-48c3-adde-5f72eea5793b@googlegroups.com> Cancel-Lock: sha1:hRVrScLrg3kpMvB5dNIdqUEG50g= Xref: csiph.com comp.databases.ms-sqlserver:1872 On 2015-02-02 07:16, rja.carnegie@gmail.com wrote: [...] > I wonder if you need to write the statement as a JOIN > given that we know we're interested in "wives" of > employee id = 3. Why not just: > > SELECT * FROM Employee WHERE EmpPartner = 3; > Yes, good observation > This is a strange problem in many ways. One database > seems to contain multiple firms and their employees, > and the tax authorities get to use it as well? > And it's implied that any possible wife is recorded > in the employee table? > Agreed [...] > > Enforcement would meant that only one Employee - > one wife - can have EmpPartner = 3. > > I'm not sure how to write that rule. > UNIQUE ( EmpPartner ); > Anyway, maybe the database designer anticipated > legal polygamy if Mitt Romney had won. > :-) [...]