Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: How do they get the answer?

Re: How do they get the answer?

From: Pat Hildebrand <pat_at_ssc.upenn.edu>
Date: Tue, 21 Aug 2001 11:37:10 -0700
Message-ID: <F001.00372E76.20010821110626@fatcity.com>

This is a poorly written question. I would guess that since it is the teacher table the assumption is that the ID is unique, even a primary key (it is not null), but none of this is stated so it doesn't have to be the case. Although I can't see it making any sense to repeat the salary (if indeed this is the salary for the teacher rather than the course), if a teacher can be in more than once that block could be used an example of an update not doing what was expected.

The update is done on subject_id and it is the record with that subject_id. If a teacher is teaching more than one course and the salary if for the teacher rather than the course, we end up with the possibility of different salaries for the same teacher and if the teacher happened to be teaching both and therefore was to get two raises what happens but those two records are now consistent at the wrong value.

Of course with what info is given in the question there are other possibilities for what the table really represents and what the PL/SQL block is supposed to do.

I would think an essay question on what is going on would be more revealing of the individual's knowledge than a flawed multiple guess question. I don't think I have ever heard of it for anything other than true-false but justifying the selection might make it a little more useful.

                       Pat


>
> Examine the structure of the TEACHER table:
>
> Name Null? Type
> ID NOT NULL NUMBER(9)
> SALARY NUMBER
> (7,2)
> SUBJECT_ID NOT NULL NUMBER(3)
> SUBJECT_DESCRIPTION VARCHAR2(2)
>
> There are 200 teachers and 15 subjects. Each subject is
> taught
> by at least 2 teachers.
>
> Evaluate this PL/SQL block:
>
> DECLARE
> v_pct_raise number := 1.10;
> BEGIN
> UPDATE teacher
> SET salary = salary * 1.10
> WHERE subject_id IN (102, 105);
> COMMIT;
> END;
>
> Which result will the PL/SQL block provide?
>
> (A) Only two teachers will receive a 10% salary increase.
> (B) All of the teachers will receive a 10% salary
> increase.
> (C) At least four teachers will receive a 10% salary
> increase.
> (D) A syntax error will occur.
>
> Answer:
> (C)

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Pat Hildebrand
  INET: pat_at_ssc.upenn.edu

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Tue Aug 21 2001 - 13:37:10 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US