(no subject)
31 March 2002 14:24bloody SQL assignment is killing me.
"List all data from the Person table who are niether staff nor patients."
fucked if I know.
Why does
WHERE person.person_id = staff.person_id
AND person.person_id = admission.patient_id
work and
WHERE person.person_id <> staff.person_id
AND person.person_id <> admission.patient_id
not?
"List all data from the Person table who are niether staff nor patients."
fucked if I know.
Why does
WHERE person.person_id = staff.person_id
AND person.person_id = admission.patient_id
work and
WHERE person.person_id <> staff.person_id
AND person.person_id <> admission.patient_id
not?
no subject
Date: 30 Mar 2002 20:28 (UTC)no subject
Date: 30 Mar 2002 20:29 (UTC)no subject
Date: 30 Mar 2002 20:32 (UTC)no subject
Date: 30 Mar 2002 20:35 (UTC)no subject
Date: 30 Mar 2002 20:37 (UTC)no subject
Date: 30 Mar 2002 20:33 (UTC)no subject
Date: 30 Mar 2002 20:29 (UTC)that's more or less what it should be, but 'type' would be the field you're using for the staff/patient flag. lemme know if that works, it's just off the top of my head.
no subject
Date: 30 Mar 2002 20:31 (UTC)no subject
Date: 30 Mar 2002 20:35 (UTC)no subject
Date: 30 Mar 2002 20:45 (UTC)no subject
Date: 30 Mar 2002 20:47 (UTC)jeez I hate programming of any sorts
no subject
Date: 30 Mar 2002 20:52 (UTC)i guess that's why i never really stick with my comp sci courses, they just frustrate me too much.
no subject
Date: 30 Mar 2002 21:10 (UTC)no subject
Date: 30 Mar 2002 21:52 (UTC)no subject
Date: 30 Mar 2002 21:53 (UTC)To answer the question.
Imagine the world's most fucking insane DBA came up with the following tables:
Now, try the first select: "Select first_name, last_name from table_1, table_2 where table_1.id = table_2.id"
Starting at the first row. We have table_1.id = 1, and first_name = 'Charles'. Looking across to the second table, we find all the rows where table_1.id = table_2.id. There's only one of those rows, and that joins me across to my last name, 'Miller'. So the results table will be:
Now for the second query. "Select first_name, last_name from table_1, table_2 where table_1.id <> table_2.id"
First, we look at the first row. The first_name is 'Charles', and the id is 1. Now we look at the second table, and find our join is telling us "find all the rows where table_1.id is NOT the same as table_2.id." The first row doesn't match this condition, but the other two do. So the result of this query would be:
no subject
Date: 30 Mar 2002 21:56 (UTC)Try this
Date: 30 Mar 2002 23:31 (UTC)It's not elegant, but it should work.
Select *
From person
where person.person_id not in (select staff.person_id from staff)
and person.person_id not in (select admission.patient_id from admission)
In other words, I want everything in set 1 that does not have a matching ID in set 2 or set 3. [Subquery solution]
Re: Try this
Date: 31 Mar 2002 02:02 (UTC)Re: Try this
Date: 31 Mar 2002 05:19 (UTC)my brain hurts
Date: 31 Mar 2002 01:22 (UTC)New Hoo Hoo Math!
It won't do you a bit of good to try and review math!
It's so simple, so very simple, that only a child can do it!!
-Tom Lehrer/New Math (after a long explanation of a hundreds multiplication table doone is base 8 with additions and distractions).
I can't even begin to decipher either problem. Just reading the abbreviations made my temples throb.I'll stick to HTML for dumbos.:D