Examine the structure and data of the CUST_TRANS table:
Dates are stored in the default date format dd-mon-rr in the CUST_TRANS table. Which
three SQL statements would execute successfully?
A.
SELECT transdate + ’10’ FROM cust_trans;
B.
SELECT * FROM cust_trans WHERE transdate = ’01-01-07′;
C.
SELECT transamt FROM cust_trans WHERE custno > “11”;
D.
SELECT * FROM cust_trans WHERE transdate=’01-JANUARY-07′;
E.
SELECT custno + ‘A’ FROM cust_trans WHERE transamt > 2000;
Answer C is not correct.
Correct syntax would be:
SELECT transamt FROM cust_trans WHERE custno > ’11’;
shape is Correct .
Answer will be A, D & E
C is not correct because double quotes is used. The correct is `11` and not “11”.
E is not correct because ‘A’ is not a valid number.
A C and E.
A. because of implicity conversion of 10
C. we can assume that author mean ” not “”
D. default format dd-mon-yyyy and all of it combinations, like dd-month-yyyy
E is wrong because concatenation of string is done by || or CONCAT function
Correct Answers: A,C & D
SQL> desc cust_trans;
Name Null? Type
—————————————– ——– —————————-
CUSTNO NOT NULL CHAR(2)
TRANSDATE DATE
TRANSAMT NUMBER(6,2)
SQL>
SQL> select TRANSAMT from cust_trans where CUSTNO > “11” ;
select TRANSAMT from cust_trans where CUSTNO > “11”
*
ERROR at line 1:
ORA-00904: “11”: invalid identifier
SQL>