Examine the structure of the EMPLOYEES table:
Which INSERT statement is valid?
A.
INSERT INTO employees (employee_id, first_name, last_name, hire_date)
VALUES ( 1000, �John�, �Smith�, �01/01/01�);
B.
INSERT INTO employees(employee_id, first_name, last_name, hire_date)
VALUES ( 1000, �John�, �Smith�, �01 January 01�);
C.
INSERT INTO employees(employee_id, first_name, last_name, Hire_date)
VALUES ( 1000, �John�, �Smith�, To_date(�01/01/01�));
D.
INSERT INTO employees(employee_id, first_name, last_name, hire_date)
VALUES ( 1000, �John�, �Smith�, 01-Jan-01);
Explanation:
It is the only statement that has a valid date; all other will result in an error.
Answer A is incorrect, syntax error, invalid date format
If � means single quote then answer B is fine since when tested inserts 01-Jan-01. Can somebody explain why it is not the correct answer list alongwith answer D?
DROP TABLE ODATA;
CREATE TABLE ODATA
(
ODATA DATE
) ;
INSERT INTO ODATA VALUES(’01 January 01′);
INSERT INTO ODATA VALUES(’01-Jan-01′);
Corect answer B,D;
B is fine anwser!!
B is not correct because you need to cast explicitly the value of the fourth column using TO_DATE function.
it is by default date format of oracle dd-mon-rr so no need to be define to_date()
Ans b is correct
first read the oracle documentation..you have to use to_date function if B is correct
Assuming the “?” as single quotes, only option B is right. in option D, these quotes are missing, so its not a valid statement.
Option B don’t have the symbol ‘-‘ so it isn’t in the default format
Please note that ‘-‘ is not the only separator.
If the DATE format follows that stated below then you do not need a format mask….
[D|DD] separator1 [MON|MONTH] separator2 [R|RR|YY|YYYY] — The separator1 and separator2 elements may be most punctuation marks, spaces and tabs or evening “nothing”, they can also be different.
B is the right answer
B
A , B , C works on my db. D in order to be valid must have the single quotes.
B is the correct answer, assuming the “?” represents single quotes.
D would work, if there were quotes.