dbTalk Databases Forums  

HELP why will the statement update all the order_date to Sysdate?

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss HELP why will the statement update all the order_date to Sysdate? in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
OracleDream
 
Posts: n/a

Default HELP why will the statement update all the order_date to Sysdate? - 06-25-2008 , 01:43 AM






I am preparing for 1z0--047 now. There is one question I can not
understand.


View the Exhibit and examine the structure of the ORDERS and
ORDER_ITEMS tables.

Orders

NAME NULL? TYPE
order_id not null number(12)
order_date date
customer_id number(6)
order_total number(8,2)


Order_Items

NAME NULL? TYPE
order_id not null number(3)
product_id not null number(2)
qty number(6,2)
unit_price number(8,2)


In the ORDERS table, ORDER_ID is the PRIMARY KEY and ORDER_DATE has
the DEFAULT value as SYSDATE.

Evaluate teh following statement:

UPDATE orders
SET order_date=DEFAULT
WHERE order_id IN (SELECT order_id FROM order_items
WHERE qty IS NULL);


What would be the outcome of the above statement?

A. The UPDATE statement would not work because the main query and the
subquery use different tables.
B. The UPDATE statement would not work because the DEFAULT value can
be used only in INSERT statements.
C. The UPDATE statement would change all ORDER_DATE values to SYSDATE
provided the current
ORDER_DATE is NOT NULL and QTY is NULL.
D. The UPDATE statement would change all the ORDER_DATE values to
SYSDATE irrespective of what the
current ORDER_DATE value is for all orders where QTY is NULL.

The answer is D. I don't get it. I tested this statement serveral
times. the answer should be C ( at least C is the closest question)


Please help, guys!

Reply With Quote
  #2  
Old   
Shakespeare
 
Posts: n/a

Default Re: HELP why will the statement update all the order_date to Sysdate? - 06-25-2008 , 01:54 AM







"OracleDream" <fateuk.w (AT) googlemail (DOT) com> schreef in bericht
news:7efaef15-7bd3-448a-9489-3beea277c7a6 (AT) e39g2000hsf (DOT) googlegroups.com...
Quote:
I am preparing for 1z0--047 now. There is one question I can not
understand.


View the Exhibit and examine the structure of the ORDERS and
ORDER_ITEMS tables.

Orders

NAME NULL? TYPE
order_id not null number(12)
order_date date
customer_id number(6)
order_total number(8,2)


Order_Items

NAME NULL? TYPE
order_id not null number(3)
product_id not null number(2)
qty number(6,2)
unit_price number(8,2)


In the ORDERS table, ORDER_ID is the PRIMARY KEY and ORDER_DATE has
the DEFAULT value as SYSDATE.

Evaluate teh following statement:

UPDATE orders
SET order_date=DEFAULT
WHERE order_id IN (SELECT order_id FROM order_items
WHERE qty IS NULL);


What would be the outcome of the above statement?

A. The UPDATE statement would not work because the main query and the
subquery use different tables.
B. The UPDATE statement would not work because the DEFAULT value can
be used only in INSERT statements.
C. The UPDATE statement would change all ORDER_DATE values to SYSDATE
provided the current
ORDER_DATE is NOT NULL and QTY is NULL.
D. The UPDATE statement would change all the ORDER_DATE values to
SYSDATE irrespective of what the
current ORDER_DATE value is for all orders where QTY is NULL.

The answer is D. I don't get it. I tested this statement serveral
times. the answer should be C ( at least C is the closest question)


Please help, guys!
Did you notice the NOT in

Quote:
provided the current ORDER_DATE is NOT NULL
?

With the DEFAULT clause, null values will be updated too, so C could NEVER
be correct. I tested this on my db and D is correct: ALL records will be
updated to sysdate.


Shakespeare




Reply With Quote
  #3  
Old   
Shakespeare
 
Posts: n/a

Default Re: HELP why will the statement update all the order_date to Sysdate? - 06-25-2008 , 01:54 AM




"OracleDream" <fateuk.w (AT) googlemail (DOT) com> schreef in bericht
news:7efaef15-7bd3-448a-9489-3beea277c7a6 (AT) e39g2000hsf (DOT) googlegroups.com...
Quote:
I am preparing for 1z0--047 now. There is one question I can not
understand.


View the Exhibit and examine the structure of the ORDERS and
ORDER_ITEMS tables.

Orders

NAME NULL? TYPE
order_id not null number(12)
order_date date
customer_id number(6)
order_total number(8,2)


Order_Items

NAME NULL? TYPE
order_id not null number(3)
product_id not null number(2)
qty number(6,2)
unit_price number(8,2)


In the ORDERS table, ORDER_ID is the PRIMARY KEY and ORDER_DATE has
the DEFAULT value as SYSDATE.

Evaluate teh following statement:

UPDATE orders
SET order_date=DEFAULT
WHERE order_id IN (SELECT order_id FROM order_items
WHERE qty IS NULL);


What would be the outcome of the above statement?

A. The UPDATE statement would not work because the main query and the
subquery use different tables.
B. The UPDATE statement would not work because the DEFAULT value can
be used only in INSERT statements.
C. The UPDATE statement would change all ORDER_DATE values to SYSDATE
provided the current
ORDER_DATE is NOT NULL and QTY is NULL.
D. The UPDATE statement would change all the ORDER_DATE values to
SYSDATE irrespective of what the
current ORDER_DATE value is for all orders where QTY is NULL.

The answer is D. I don't get it. I tested this statement serveral
times. the answer should be C ( at least C is the closest question)


Please help, guys!
Did you notice the NOT in

Quote:
provided the current ORDER_DATE is NOT NULL
?

With the DEFAULT clause, null values will be updated too, so C could NEVER
be correct. I tested this on my db and D is correct: ALL records will be
updated to sysdate.


Shakespeare




Reply With Quote
  #4  
Old   
Shakespeare
 
Posts: n/a

Default Re: HELP why will the statement update all the order_date to Sysdate? - 06-25-2008 , 01:54 AM




"OracleDream" <fateuk.w (AT) googlemail (DOT) com> schreef in bericht
news:7efaef15-7bd3-448a-9489-3beea277c7a6 (AT) e39g2000hsf (DOT) googlegroups.com...
Quote:
I am preparing for 1z0--047 now. There is one question I can not
understand.


View the Exhibit and examine the structure of the ORDERS and
ORDER_ITEMS tables.

Orders

NAME NULL? TYPE
order_id not null number(12)
order_date date
customer_id number(6)
order_total number(8,2)


Order_Items

NAME NULL? TYPE
order_id not null number(3)
product_id not null number(2)
qty number(6,2)
unit_price number(8,2)


In the ORDERS table, ORDER_ID is the PRIMARY KEY and ORDER_DATE has
the DEFAULT value as SYSDATE.

Evaluate teh following statement:

UPDATE orders
SET order_date=DEFAULT
WHERE order_id IN (SELECT order_id FROM order_items
WHERE qty IS NULL);


What would be the outcome of the above statement?

A. The UPDATE statement would not work because the main query and the
subquery use different tables.
B. The UPDATE statement would not work because the DEFAULT value can
be used only in INSERT statements.
C. The UPDATE statement would change all ORDER_DATE values to SYSDATE
provided the current
ORDER_DATE is NOT NULL and QTY is NULL.
D. The UPDATE statement would change all the ORDER_DATE values to
SYSDATE irrespective of what the
current ORDER_DATE value is for all orders where QTY is NULL.

The answer is D. I don't get it. I tested this statement serveral
times. the answer should be C ( at least C is the closest question)


Please help, guys!
Did you notice the NOT in

Quote:
provided the current ORDER_DATE is NOT NULL
?

With the DEFAULT clause, null values will be updated too, so C could NEVER
be correct. I tested this on my db and D is correct: ALL records will be
updated to sysdate.


Shakespeare




Reply With Quote
  #5  
Old   
Shakespeare
 
Posts: n/a

Default Re: HELP why will the statement update all the order_date to Sysdate? - 06-25-2008 , 01:54 AM




"OracleDream" <fateuk.w (AT) googlemail (DOT) com> schreef in bericht
news:7efaef15-7bd3-448a-9489-3beea277c7a6 (AT) e39g2000hsf (DOT) googlegroups.com...
Quote:
I am preparing for 1z0--047 now. There is one question I can not
understand.


View the Exhibit and examine the structure of the ORDERS and
ORDER_ITEMS tables.

Orders

NAME NULL? TYPE
order_id not null number(12)
order_date date
customer_id number(6)
order_total number(8,2)


Order_Items

NAME NULL? TYPE
order_id not null number(3)
product_id not null number(2)
qty number(6,2)
unit_price number(8,2)


In the ORDERS table, ORDER_ID is the PRIMARY KEY and ORDER_DATE has
the DEFAULT value as SYSDATE.

Evaluate teh following statement:

UPDATE orders
SET order_date=DEFAULT
WHERE order_id IN (SELECT order_id FROM order_items
WHERE qty IS NULL);


What would be the outcome of the above statement?

A. The UPDATE statement would not work because the main query and the
subquery use different tables.
B. The UPDATE statement would not work because the DEFAULT value can
be used only in INSERT statements.
C. The UPDATE statement would change all ORDER_DATE values to SYSDATE
provided the current
ORDER_DATE is NOT NULL and QTY is NULL.
D. The UPDATE statement would change all the ORDER_DATE values to
SYSDATE irrespective of what the
current ORDER_DATE value is for all orders where QTY is NULL.

The answer is D. I don't get it. I tested this statement serveral
times. the answer should be C ( at least C is the closest question)


Please help, guys!
Did you notice the NOT in

Quote:
provided the current ORDER_DATE is NOT NULL
?

With the DEFAULT clause, null values will be updated too, so C could NEVER
be correct. I tested this on my db and D is correct: ALL records will be
updated to sysdate.


Shakespeare




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.