Exam 1z0-071 All QuestionsBrowse all questions from this exam
Question 2

Examine the description of the PRODUCTS table:

Which three queries use valid expressions? (Choose three.)

    Correct Answer: B, C, F

    The three queries that use valid expressions are: 1. SELECT product_id, (unit_price * 0.15 / (4.75 + 552.25)) FROM products; This query is valid because it uses a mathematical expression involving unit_price, which is of type NUMBER. 2. SELECT product_id, (expiry_date - delivery_date) * 2 FROM products; This query is valid because it calculates the difference between two dates, which yields a NUMBER representing the number of days between them. This result can then be multiplied by 2. 3. SELECT product_id, unit_price, unit_price + surcharge FROM products; This query is valid assuming that the VARCHAR2 column surcharge contains numeric values. Oracle SQL implicitly converts VARCHAR2 to NUMBER in such cases, making the addition valid.

Discussion
dumpsvibeOptions: BCF

B and C are right but F is a tricky one

GunduzHuseynliOptions: BCE

BCE should be correct answer cause number+varchar in this case imspossible

extopic01

Have u tried it yourself in livesql.oracle.com? Number + varchar is possible due to implicit casting, so BCF is correct.

gioves28

E is wrong inconsistent datatypes: expected NUMBER got DATE

MZEnuovazelandaOptions: BCF

IT is correct BCF because in the Datatype Varchar2 there may be a number. Oracle makes it an implicit cast and uses it as a number

gabolkaOptions: BCF

you cant multiply date, BCF correct if varchar2 is number

Efstathia

Just to say the same things in other words.... If surcharge column contains numeric values (even as varchar2 type) can be implicitly converted

CyberP

If you cant multiply date, then why you chose c ? since c the date is also multiply ?

MySekQL

I'm guessing because if you subtract two dates that are relatively close, you will get a number not a date. And that CAN be multiplied.

jm9999Options: BCF

Seems like a sketchy question, have to assume surcharge contains only numerical characters in the string for F

fantastic_side_eyeOptions: BCF

BCF The three queries that use valid expressions are: B. SELECT product_id, (unit_price * 0.15 / (4.75 + 552.25)) FROM products; C. SELECT product_id, (expiry_date - delivery_date) * 2 FROM products; F. SELECT product_id, unit_price, unit_price + surcharge FROM products; Explanation: A. This query is invalid because the alias "S" is not defined anywhere in the query. B. This query is valid. It calculates a value based on the unit price of each product using a mathematical expression. C. This query is valid. It calculates the difference between the expiry date and delivery date for each product and multiplies it by 2. D. This query is invalid because the alias "discount" is not defined anywhere in the query. E. This query is invalid because you cannot multiply a date value by a number. F. This query is valid. It selects the product ID, unit price, and the sum of the unit price and surcharge for each product.

Lee_jong_sukOptions: BCF

BCF is correct answer Please note: date+date is not allowed

zouve

select '2'+3 from dual; it produces the SUM correctly so F is correct

NelitaOptions: BCF

B-C-F IS CORRECT IF the varchar-column has stored number.

Indhumathishan

why is D incorrect?

AveragenoobOptions: BCE

bce should be

alelejajaOptions: BCF

B and C clearly correct. F is tricky. It can be correct only if the column Surcharge contains numeric characters defined as varchar2

tom2992Options: BCF

A and D wrong cause they have invalid identifier "Discount". E wrong cause date can't multiple with number.

TMerloOptions: BCF

It´s not a right decision plus a NUMBER with VARCHAR2 fields.

holdfaststrongly

Is "-discount" in AD supposed to be an alias for the column?