View the exhibit and examine the structure of the STORES table.
STORES table
Name Null? Type—————– —– ————-
STORE_ID NUMBER
NAME VARCHAR2(100)
ADDRESS VARCHAR2(200)
CITY VARCHAR2(100)
COUNTRY VARCHAR2(100)
START_DATE DATE
END_DATE DATE
PROPERTY_PRICE NUMBER
You want to display the NAME of the store along with the ADDRESS, START_DATE, PROPERTY_PRICE, and the
projected property price, which is 115% of property price.
The stores displayed must have START_DATE in the range of 36 months starting from 01-Jan-2000 and above.
Which SQL statement would get the desired output?
A.
SELECT name, concat (address| | ‘,’| |city| |’, ‘, country) AS full_address,
start_date,
property_price, property_price*115/100
FROM stores
WHERE MONTHS_BETWEEN (start_date, ’01-JAN-2000′) <=36;
B.
SELECT name, concat (address| | ‘,’| |city| |’, ‘, country) AS full_address,
start_date,
property_price, property_price*115/100
FROM stores
WHERE TO_NUMBER(start_date-TO_DATE(’01-JAN-2000′,’DD-MON-RRRR’)) <=36;
C.
SELECT name, address||’,’||city||’,’||country AS full_address,
start_date,
property_price, property_price*115/100
FROM stores
WHERE MONTHS_BETWEEN (start_date, TO_DATE(’01-JAN-2000′,’DD-MON-RRRR’)) <=36;
D.
SELECT name, concat (address||’,’| |city| |’, ‘, country) AS full_address,
start_date,
property_price, property_price*115/100
FROM stores
WHERE MONTHS_BETWEEN (start_date, TO_DATE(’01-JAN-2000′,’DD-MON-RRRR’)) <=36;
What is the problem with C? Is it a space symbol before country in full_address?
C in original:
SELECT name, address||’, ‘||city||’, ‘||country AS full_address,
start_date,
property_price, property_price*15/100
FROM stores
WHERE MONTHS_BETWEEN (start_date, TO_DATE(’01-JAN-2000′,’DD-MON-RRRR’)) <=36;
Therefore only D is correct.
The problem in property_price*15/100 ??
instead, property_price*150/100 ?
“What is the problem with C? Is it a space symbol before country in full_address?”
+1
I can’t understand too…
How D could work if there is space between | |
?
In my opinion C is better
How D could work if there is space between | |
?
this operator works well || | | (with space). I have tested it.