Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
658
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.84 KB | None | 0 0
  1. 1. You have been asked to create a report that lists all customers who have placed orders of at least $2,500. The report's date should be displayed using this format:
  2. Day, Date Month, Year (For example, Tuesday, 13 April, 2004 ).
  3. Which statement should you issue? Mark for Review
  4. (1) Points
  5.  
  6.  
  7. SELECT companyname, TO_CHAR (sysdate, 'fmdd, dy month, yyyy'), total
  8. FROM customers NATURAL JOIN orders
  9. WHERE total >= 2500;
  10.  
  11.  
  12. SELECT companyname, TO_CHAR (sysdate, 'fmDay, dd Month, yyyy'), total
  13. FROM customers NATURAL JOIN orders
  14. WHERE total >= 2500;
  15. (*)
  16.  
  17.  
  18.  
  19. SELECT companyname, TO_DATE (sysdate, 'dd, dy month, yyyy'), total
  20. FROM customers NATURAL JOIN orders
  21. WHERE total >= 2500;
  22.  
  23.  
  24. SELECT companyname, TO_DATE (date, 'day, dd month, yyyy'), total
  25. FROM customers NATURAL JOIN orders
  26. WHERE total >= 2500;
  27.  
  28.  
  29.  
  30. Correct Correct
  31.  
  32.  
  33. 2. Which three statements concerning explicit data type conversions are true? (Choose three.) Mark for Review
  34. (1) Points
  35.  
  36. (Choose all correct answers)
  37.  
  38.  
  39. Use the TO_DATE function to convert a date value to a character string or number.
  40.  
  41.  
  42. Use the TO_DATE function to convert a character string to a date value. (*)
  43.  
  44.  
  45. Use the TO_NUMBER function to convert a number to a character string.
  46.  
  47.  
  48. Use the TO_CHAR function to convert a number or date value to a character string. (*)
  49.  
  50.  
  51. Use the TO_NUMBER function to convert a character string of digits to a number. (*)
  52.  
  53.  
  54.  
  55. Incorrect Incorrect. Refer to Section 5 Lesson 1.
  56.  
  57.  
  58. 3. If you use the RR format when writing a query using the date 27-Oct-17 and the year is 2001, what year would be the result? Mark for Review
  59. (1) Points
  60.  
  61.  
  62. 1917
  63.  
  64.  
  65. 2017 (*)
  66.  
  67.  
  68. 1901
  69.  
  70.  
  71. 2001
  72.  
  73.  
  74.  
  75. Incorrect Incorrect. Refer to Section 5 Lesson 1.
  76.  
  77.  
  78. 4. Which functions allow you to perform explicit data type conversions? Mark for Review
  79. (1) Points
  80.  
  81.  
  82. ROUND, TRUNC, ADD_MONTHS
  83.  
  84.  
  85. TO_CHAR, TO_DATE, TO_NUMBER (*)
  86.  
  87.  
  88. NVL, NVL2, NULLIF
  89.  
  90.  
  91. LENGTH, SUBSTR, LPAD, TRIM
  92.  
  93.  
  94.  
  95. Correct Correct
  96.  
  97.  
  98. 5. The EMPLOYEES table contains these columns:
  99. EMPLOYEE_ID NUMBER(9)
  100. LAST_NAME VARCHAR2 (25)
  101. FIRST_NAME VARCHAR2 (25)
  102. SALARY NUMBER(6)
  103. You need to create a report to display the salaries of all employees. Which SQL Statement should you use to display the salaries in format: "$45,000.00"?
  104.  
  105. Mark for Review
  106. (1) Points
  107.  
  108.  
  109. SELECT TO_NUM(salary, '$999,999.00')
  110. FROM employees;
  111.  
  112.  
  113. SELECT TO_CHAR(salary, '$999,999')
  114. FROM employees;
  115.  
  116.  
  117. SELECT TO_CHAR(salary, '$999,999.00')
  118. FROM employees;
  119. (*)
  120.  
  121.  
  122.  
  123. SELECT TO_NUM(salary, '$999,990.99')
  124. FROM employees;
  125.  
  126.  
  127.  
  128. Incorrect Incorrect. Refer to Section 5 Lesson 1.
  129.  
  130. 6. Which best describes the TO_CHAR function? Mark for Review
  131. (1) Points
  132.  
  133.  
  134. The TO_CHAR function can be used to remove text from column data that will be returned by the database.
  135.  
  136.  
  137. The TO_CHAR function can be used to display dates and numbers according to formatting conventions that are supported by Oracle. (*)
  138.  
  139.  
  140. The TO_CHAR function can only be used on Date columns.
  141.  
  142.  
  143. The TO_CHAR function can be used to specify meaningful column names in an SQL statement's result set.
  144.  
  145.  
  146.  
  147. Correct Correct
  148.  
  149.  
  150. 7. Which statement about group functions is true? Mark for Review
  151. (1) Points
  152.  
  153.  
  154. NVL, NVL2, and COALESCE can be used with group functions to replace null values. (*)
  155.  
  156.  
  157. NVL and COALESCE, but not NVL2, can be used with group functions to replace null values.
  158.  
  159.  
  160. NVL and NVL2, but not COALESCE, can be used with group functions to replace null values.
  161.  
  162.  
  163. COALESCE, but not NVL and NVL2, can be used with group functions to replace null values.
  164.  
  165.  
  166.  
  167. Incorrect Incorrect. Refer to Section 5 Lesson 2.
  168.  
  169.  
  170. 8. If quantity is a number datatype, what is the result of this statement?
  171. SELECT NVL(200/quantity, 'zero') FROM inventory; Mark for Review
  172. (1) Points
  173.  
  174.  
  175. Null
  176.  
  177.  
  178. The statement fails (*)
  179.  
  180.  
  181. ZERO
  182.  
  183.  
  184. zero
  185.  
  186.  
  187.  
  188. Correct Correct
  189.  
  190.  
  191. 9. The following statement returns 0 (zero). True or False?
  192. SELECT 121/NULL
  193. FROM dual; Mark for Review
  194. (1) Points
  195.  
  196.  
  197. True
  198.  
  199.  
  200. False (*)
  201.  
  202.  
  203.  
  204. Correct Correct
  205.  
  206.  
  207. 10. Which of the following General Functions will return the first non-null expression in the expression list? Mark for Review
  208. (1) Points
  209.  
  210.  
  211. NVL
  212.  
  213.  
  214. NVL2
  215.  
  216.  
  217. NULLIF
  218.  
  219.  
  220. COALESCE (*)
  221.  
  222.  
  223.  
  224. Incorrect Incorrect. Refer to Section 5 Lesson 2.11. Which function compares two expressions? Mark for Review
  225. (1) Points
  226.  
  227.  
  228. NVL
  229.  
  230.  
  231. NULLIF (*)
  232.  
  233.  
  234. NULL
  235.  
  236.  
  237. NVL2
  238.  
  239.  
  240.  
  241. Incorrect Incorrect. Refer to Section 5 Lesson 2.
  242.  
  243.  
  244. 12. With the following data in Employees (last_name, commission_pct, manager_id) what is the result of the following statement?
  245. DATA:
  246. King, null, null
  247. Kochhar, null, 100
  248. Vargas, null, 124
  249. Zlotkey, .2, 100
  250. SELECT last_name, NVL2(commission_pct, manager_id, -1) comm
  251. FROM employees ;
  252.  
  253. Mark for Review
  254. (1) Points
  255.  
  256.  
  257. Statement will fail.
  258.  
  259.  
  260. King, -1
  261. Kochhar, 100
  262. Vargas, 124
  263. Zlotkey, .2
  264.  
  265.  
  266. King, -1
  267. Kochhar, -1
  268. Vargas, -1
  269. Zlotkey, .2
  270.  
  271.  
  272. King, -1
  273. Kochhar, -1
  274. Vargas, -1
  275. Zlotkey, 100
  276. (*)
  277.  
  278.  
  279.  
  280.  
  281. Incorrect Incorrect. Refer to Section 5 Lesson 2.
  282.  
  283.  
  284. 13. For the given data from Employees (last_name, manager_id) what is the result of the following statement:
  285. DATA:( King, null
  286. Kochhar, 100
  287. De Haan, 100
  288. Hunold, 102
  289. Ernst, 103)
  290. SELECT last_name,
  291. DECODE(manager_id, 100, 'King', 'A N Other') "Works For?"
  292. FROM employees
  293.  
  294. Mark for Review
  295. (1) Points
  296.  
  297.  
  298. Invalid statement.
  299.  
  300.  
  301. King, Null
  302. Kochhar, King
  303. De Haan, King
  304. Hunold, A N Other
  305. Ernst, A N Other
  306.  
  307.  
  308. King, A N Other
  309. Kochhar, King
  310. De Haan, King
  311. Hunold, Kochhar
  312. Ernst, De Haan
  313.  
  314.  
  315. King, A N Other
  316. Kochhar, King
  317. De Haan, King
  318. Hunold, A N Other
  319. Ernst, A N Other
  320. (*)
  321.  
  322.  
  323.  
  324.  
  325. Incorrect Incorrect. Refer to Section 5 Lesson 3.
  326.  
  327.  
  328. 14. Which statement will return a listing of last names, salaries, and a rating of 'Low', 'Medium', 'Good' or 'Excellent' depending on the salary value? Mark for Review
  329. (1) Points
  330.  
  331.  
  332. SELECT last_name,salary,
  333. (RATING WHEN salary<5000 THEN 'Low'
  334. WHEN salary<10000 THEN 'Medium'
  335. WHEN salary<20000 THEN 'Good'
  336. ELSE 'Excellent'
  337. END) qualified_salary
  338. FROM employees;
  339.  
  340.  
  341. SELECT last_name,sal,
  342. (CASE WHEN sal<5000 THEN 'Low'
  343. WHEN sal<10000 THEN 'Medium'
  344. WHEN sal<20000 THEN 'Good'
  345. ELSE 'Excellent'
  346. END) qualified_salary
  347. FROM employees;
  348.  
  349.  
  350. SELECT last_name,salary,
  351. (CASE WHEN salary<5000 THEN 'Low'
  352. WHEN sal <10000 THEN 'Medium'
  353. WHEN sal <20000 THEN 'Good'
  354. ELSE 'Excellent'
  355. END) qualified_salary
  356. FROM employees;
  357.  
  358.  
  359. SELECT last_name,salary,
  360. (CASE WHEN salary<5000 THEN 'Low'
  361. WHEN salary<10000 THEN 'Medium'
  362. WHEN salary<20000 THEN 'Good'
  363. ELSE 'Excellent'
  364. END) qualified_salary
  365. FROM employees;
  366. (*)
  367.  
  368.  
  369.  
  370.  
  371. Incorrect Incorrect. Refer to Section 5 Lesson 3.
  372.  
  373.  
  374. 15. Which of the following is a conditional expression used in SQL? Mark for Review
  375. (1) Points
  376.  
  377.  
  378. WHERE
  379.  
  380.  
  381. DESCRIBE
  382.  
  383.  
  384. CASE (*)
  385.  
  386.  
  387. NULLIF
  388.  
  389.  
  390.  
  391. Incorrect Incorrect. Refer to Section 5 Lesson 3.1. Which of the following General Functions will return the first non-null expression in the expression list? Mark for Review
  392. (1) Points
  393.  
  394.  
  395. NULLIF
  396.  
  397.  
  398. NVL
  399.  
  400.  
  401. NVL2
  402.  
  403.  
  404. COALESCE (*)
  405.  
  406.  
  407.  
  408. Correct Correct
  409.  
  410.  
  411. 2. The following statement returns 0 (zero). True or False?
  412. SELECT 121/NULL
  413. FROM dual; Mark for Review
  414. (1) Points
  415.  
  416.  
  417. True
  418.  
  419.  
  420. False (*)
  421.  
  422.  
  423.  
  424. Incorrect Incorrect. Refer to Section 5 Lesson 2.
  425.  
  426.  
  427. 3. Consider the following data in the Employees table: (last_name, commission_pct, manager_id)
  428. DATA:
  429. King, null, null
  430. Kochhar, null, 100
  431. Vargas, null, 124
  432. Zlotkey, .2, 100
  433. What is the result of the following statement:
  434. SELECT last_name, COALESCE(commission_pct, manager_id, -1) comm
  435. FROM employees ;
  436.  
  437. Mark for Review
  438. (1) Points
  439.  
  440.  
  441. King, -1
  442. Kochhar, 100
  443. Vargas, 124
  444. Zlotkey, .2
  445. (*)
  446.  
  447.  
  448.  
  449. King, -1
  450. Kochhar, 100
  451. Vargas, 124
  452. Zlotkey, 100
  453.  
  454.  
  455. King, null
  456. Kochhar, 100
  457. Vargas, 124
  458. Zlotkey, .2
  459.  
  460.  
  461. Statement will fail
  462.  
  463.  
  464.  
  465. Incorrect Incorrect. Refer to Section 5 Lesson 2.
  466.  
  467.  
  468. 4. The STYLES table contains this data:
  469. STYLE_ID STYLE_NAME CATEGORY COST
  470. 895840 SANDAL 85940 12.00
  471. 968950 SANDAL 85909 10.00
  472. 869506 SANDAL 89690 15.00
  473. 809090 LOAFER 89098 10.00
  474. 890890 LOAFER 89789 14.00
  475. 857689 HEEL 85940 11.00
  476. 758960 SANDAL 86979
  477. Evaluate this SELECT statement:
  478.  
  479. SELECT style_id, style_name, category, cost
  480. FROM styles
  481. WHERE style_name LIKE 'SANDAL' AND NVL(cost, 0) < 15.00
  482. ORDER BY category, cost;
  483.  
  484. Which result will the query provide?
  485.  
  486. Mark for Review
  487. (1) Points
  488.  
  489.  
  490.  
  491. STYLE_ID STYLE_NAME CATEGORY COST
  492. 895840 SANDAL 85909 12.00
  493. 968950 SANDAL 85909 10.00
  494. 758960 SANDAL 86979
  495. 869506 SANDAL 89690 15.00
  496.  
  497.  
  498.  
  499. STYLE_ID STYLE_NAME CATEGORY COST
  500. 895840 SANDAL 85940 12.00
  501. 968950 SANDAL 85909 10.00
  502. 758960 SANDAL 86979
  503.  
  504.  
  505.  
  506. STYLE_ID STYLE_NAME CATEGORY COST
  507. 968950 SANDAL 85909 10.00
  508. 895840 SANDAL 85940 12.00
  509. 758960 SANDAL 86979
  510. (*)
  511.  
  512.  
  513.  
  514.  
  515. STYLE_ID STYLE_NAME CATEGORY COST
  516. 895840 SANDAL 85909 12.00
  517. 968950 SANDAL 85909 10.00
  518. 869506 SANDAL 89690 15.00
  519. 758960 SANDAL 86979
  520.  
  521.  
  522.  
  523. Correct Correct
  524.  
  525.  
  526. 5. Which statement about group functions is true? Mark for Review
  527. (1) Points
  528.  
  529.  
  530. NVL and NVL2, but not COALESCE, can be used with group functions to replace null values.
  531.  
  532.  
  533. NVL, NVL2, and COALESCE can be used with group functions to replace null values. (*)
  534.  
  535.  
  536. NVL and COALESCE, but not NVL2, can be used with group functions to replace null values.
  537.  
  538.  
  539. COALESCE, but not NVL and NVL2, can be used with group functions to replace null values.
  540.  
  541.  
  542.  
  543. Incorrect Incorrect. Refer to Section 5 Lesson 2.6. With the following data in Employees (last_name, commission_pct, manager_id) what is the result of the following statement?
  544. DATA:
  545. King, null, null
  546. Kochhar, null, 100
  547. Vargas, null, 124
  548. Zlotkey, .2, 100
  549. SELECT last_name, NVL2(commission_pct, manager_id, -1) comm
  550. FROM employees ;
  551.  
  552. Mark for Review
  553. (1) Points
  554.  
  555.  
  556. Statement will fail.
  557.  
  558.  
  559. King, -1
  560. Kochhar, -1
  561. Vargas, -1
  562. Zlotkey, .2
  563.  
  564.  
  565. King, -1
  566. Kochhar, -1
  567. Vargas, -1
  568. Zlotkey, 100
  569. (*)
  570.  
  571.  
  572.  
  573. King, -1
  574. Kochhar, 100
  575. Vargas, 124
  576. Zlotkey, .2
  577.  
  578.  
  579.  
  580. Incorrect Incorrect. Refer to Section 5 Lesson 2.
  581.  
  582.  
  583. 7. Which SQL Statement should you use to display the prices in this format: "$00.30"? Mark for Review
  584. (1) Points
  585.  
  586.  
  587. SELECT TO_CHAR(price, '$99,990.99')
  588. FROM product;
  589.  
  590.  
  591. SELECT TO_NUMBER(price, '$99,900.99')
  592. FROM product;
  593.  
  594.  
  595. SELECT TO_CHAR(price, '$99,900.99')
  596. FROM product;
  597. (*)
  598.  
  599.  
  600.  
  601. SELECT TO_CHAR(price, '$99,999.99')
  602. FROM product;
  603.  
  604.  
  605.  
  606. Incorrect Incorrect. Refer to Section 5 Lesson 1.
  607.  
  608.  
  609. 8. The EMPLOYEES table contains these columns:
  610. EMPLOYEE_ID NUMBER(9)
  611. LAST_NAME VARCHAR2 (25)
  612. FIRST_NAME VARCHAR2 (25)
  613. HIRE_DATE DATE
  614.  
  615. You need to display HIRE_DATE values in this format:
  616.  
  617. January 28, 2000
  618.  
  619. Which SQL statement could you use?
  620.  
  621. Mark for Review
  622. (1) Points
  623.  
  624.  
  625. SELECT TO_CHAR(hire_date, Month DD, YYYY)
  626. FROM employees;
  627.  
  628.  
  629. SELECT TO_CHAR(hire_date, 'Month DD, YYYY')
  630. FROM employees;
  631. (*)
  632.  
  633.  
  634.  
  635. SELECT hire_date(TO_CHAR 'Month DD', ' YYYY')
  636. FROM employees;
  637.  
  638.  
  639. SELECT TO_CHAR(hire_date, 'Month DD', ' YYYY')
  640. FROM employees;
  641.  
  642.  
  643.  
  644. Incorrect Incorrect. Refer to Section 5 Lesson 1.
  645.  
  646.  
  647. 9. Which arithmetic operation will return a numeric value? Mark for Review
  648. (1) Points
  649.  
  650.  
  651. NEXT_DAY(hire_date) + 5
  652.  
  653.  
  654. TO_DATE('01-Jun-2004') - TO_DATE('01-Oct-2004') (*)
  655.  
  656.  
  657. SYSDATE - 6
  658.  
  659.  
  660. SYSDATE + 30 / 24
  661.  
  662.  
  663.  
  664. Incorrect Incorrect. Refer to Section 5 Lesson 1.
  665.  
  666.  
  667. 10. A table has the following definition: EMPLOYEES(
  668. EMPLOYEE_ID NUMBER(6) NOT NULL,
  669. NAME VARCHAR2(20) NOT NULL,
  670. MANAGER_ID VARCHAR2(6))
  671.  
  672. and contains the following rows:
  673.  
  674. (1001, 'Bob Bevan', '200')
  675. (200, 'Natacha Hansen', null)
  676.  
  677. Will the folloiwng query work?
  678.  
  679. SELECT *
  680. FROM employees
  681. WHERE employee_id = manager_id; Mark for Review
  682. (1) Points
  683.  
  684.  
  685. Yes, Oracle will perform implicit datatype conversion, but the WHERE clause will not find any matching data. (*)
  686.  
  687.  
  688. No, because the datatypes of EMPLOYEE_ID and MANAGER_ID are different.
  689.  
  690.  
  691. Yes, Oracle will perform implicit dataype conversion, and the query will return one row of data.
  692.  
  693.  
  694. No.? You will have to re-wirte the statement and perform explicit datatype conversion.
  695.  
  696.  
  697.  
  698. Incorrect Incorrect. Refer to Section 5 Lesson 1.
  699. 11. Which statement concerning single row functions is true? Mark for Review
  700. (1) Points
  701.  
  702.  
  703. Single row functions cannot modify a data type.
  704.  
  705.  
  706. Single row functions can be nested. (*)
  707.  
  708.  
  709. Single row functions can accept only one argument, but can return multiple values.
  710.  
  711.  
  712. Single row functions return one or more results per row.
  713.  
  714.  
  715.  
  716. Incorrect Incorrect. Refer to Section 5 Lesson 1.
  717.  
  718.  
  719. 12. Which two statements concerning SQL functions are true? (Choose two.) Mark for Review
  720. (1) Points
  721.  
  722. (Choose all correct answers)
  723.  
  724.  
  725. Number functions can return number or character values.
  726.  
  727.  
  728. Not all date functions return date values. (*)
  729.  
  730.  
  731. Character functions can accept numeric input.
  732.  
  733.  
  734. Single-row functions manipulate groups of rows to return one result per group of rows.
  735.  
  736.  
  737. Conversion functions convert a value from one data type to another data type. (*)
  738.  
  739.  
  740.  
  741. Incorrect Incorrect. Refer to Section 5 Lesson 1.
  742.  
  743.  
  744. 13. Which statement will return a listing of last names, salaries, and a rating of 'Low', 'Medium', 'Good' or 'Excellent' depending on the salary value? Mark for Review
  745. (1) Points
  746.  
  747.  
  748. SELECT last_name,salary,
  749. (RATING WHEN salary<5000 THEN 'Low'
  750. WHEN salary<10000 THEN 'Medium'
  751. WHEN salary<20000 THEN 'Good'
  752. ELSE 'Excellent'
  753. END) qualified_salary
  754. FROM employees;
  755.  
  756.  
  757. SELECT last_name,salary,
  758. (CASE WHEN salary<5000 THEN 'Low'
  759. WHEN sal <10000 THEN 'Medium'
  760. WHEN sal <20000 THEN 'Good'
  761. ELSE 'Excellent'
  762. END) qualified_salary
  763. FROM employees;
  764.  
  765.  
  766. SELECT last_name,salary,
  767. (CASE WHEN salary<5000 THEN 'Low'
  768. WHEN salary<10000 THEN 'Medium'
  769. WHEN salary<20000 THEN 'Good'
  770. ELSE 'Excellent'
  771. END) qualified_salary
  772. FROM employees;
  773. (*)
  774.  
  775.  
  776.  
  777. SELECT last_name,sal,
  778. (CASE WHEN sal<5000 THEN 'Low'
  779. WHEN sal<10000 THEN 'Medium'
  780. WHEN sal<20000 THEN 'Good'
  781. ELSE 'Excellent'
  782. END) qualified_salary
  783. FROM employees;
  784.  
  785.  
  786.  
  787. Incorrect Incorrect. Refer to Section 5 Lesson 3.
  788.  
  789.  
  790. 14. Which of the following is a conditional expression used in SQL? Mark for Review
  791. (1) Points
  792.  
  793.  
  794. CASE (*)
  795.  
  796.  
  797. WHERE
  798.  
  799.  
  800. NULLIF
  801.  
  802.  
  803. DESCRIBE
  804.  
  805.  
  806.  
  807. Incorrect Incorrect. Refer to Section 5 Lesson 3.
  808.  
  809.  
  810. 15. CASE and DECODE evaluate expressions in a similar way to IF-THEN-ELSE logic. However, DECODE is specific to Oracle syntax. True or False? Mark for Review
  811. (1) Points
  812.  
  813.  
  814. True (*)
  815.  
  816.  
  817. False
  818.  
  819.  
  820.  
  821. Correct Correct1. You need to display the HIRE_DATE values in this format: 25th of July 2002. Which SELECT statement would you use? Mark for Review
  822. (1) Points
  823.  
  824.  
  825. SELECT enroll_date(hire_date, 'DDspth "of" Month YYYY')
  826. FROM employees;
  827.  
  828.  
  829. SELECT TO_CHAR(hire_date, 'DDspth 'of' Month RRRR')
  830. FROM employees;
  831.  
  832.  
  833. SELECT TO_CHAR(hire_date, 'ddth "of" Month YYYY')
  834. FROM employees;
  835. (*)
  836.  
  837.  
  838.  
  839. SELECT TO_CHAR(hire_date, 'DDTH "of" Month YYYY')
  840. FROM employees;
  841.  
  842.  
  843.  
  844. Incorrect Incorrect. Refer to Section 5 Lesson 1.
  845.  
  846.  
  847. 2. Which arithmetic operation will return a numeric value? Mark for Review
  848. (1) Points
  849.  
  850.  
  851. NEXT_DAY(hire_date) + 5
  852.  
  853.  
  854. SYSDATE - 6
  855.  
  856.  
  857. TO_DATE('01-Jun-2004') - TO_DATE('01-Oct-2004') (*)
  858.  
  859.  
  860. SYSDATE + 30 / 24
  861.  
  862.  
  863.  
  864. Correct Correct
  865.  
  866.  
  867. 3. The EMPLOYEES table contains these columns:
  868. EMPLOYEE_ID NUMBER(9)
  869. LAST_NAME VARCHAR2 (25)
  870. FIRST_NAME VARCHAR2 (25)
  871. HIRE_DATE DATE
  872.  
  873. You need to display HIRE_DATE values in this format:
  874.  
  875. January 28, 2000
  876.  
  877. Which SQL statement could you use?
  878.  
  879. Mark for Review
  880. (1) Points
  881.  
  882.  
  883. SELECT hire_date(TO_CHAR 'Month DD', ' YYYY')
  884. FROM employees;
  885.  
  886.  
  887. SELECT TO_CHAR(hire_date, Month DD, YYYY)
  888. FROM employees;
  889.  
  890.  
  891. SELECT TO_CHAR(hire_date, 'Month DD', ' YYYY')
  892. FROM employees;
  893.  
  894.  
  895. SELECT TO_CHAR(hire_date, 'Month DD, YYYY')
  896. FROM employees;
  897. (*)
  898.  
  899.  
  900.  
  901.  
  902. Incorrect Incorrect. Refer to Section 5 Lesson 1.
  903.  
  904.  
  905. 4. If you use the RR format when writing a query using the date 27-Oct-17 and the year is 2001, what year would be the result? Mark for Review
  906. (1) Points
  907.  
  908.  
  909. 2017 (*)
  910.  
  911.  
  912. 1901
  913.  
  914.  
  915. 2001
  916.  
  917.  
  918. 1917
  919.  
  920.  
  921.  
  922. Correct Correct
  923.  
  924.  
  925. 5. Which functions allow you to perform explicit data type conversions? Mark for Review
  926. (1) Points
  927.  
  928.  
  929. LENGTH, SUBSTR, LPAD, TRIM
  930.  
  931.  
  932. ROUND, TRUNC, ADD_MONTHS
  933.  
  934.  
  935. NVL, NVL2, NULLIF
  936.  
  937.  
  938. TO_CHAR, TO_DATE, TO_NUMBER (*)
  939.  
  940.  
  941.  
  942. Incorrect Incorrect. Refer to Section 5 Lesson 1.6. Which statement will return the salary (for example, the salary of 6000) from the Employees table in the following format? $6000.00 Mark for Review
  943. (1) Points
  944.  
  945.  
  946. SELECT TO_CHAR(salary, '99999.00') SALARY
  947. FROM employees
  948.  
  949.  
  950. SELECT TO_CHAR(sal, '$99999.00') SALARY
  951. FROM employees
  952.  
  953.  
  954. SELECT TO_CHAR(salary, '$99999') SALARY
  955. FROM employees
  956.  
  957.  
  958. SELECT TO_CHAR(salary, '$99999.00') SALARY
  959. FROM employees
  960. (*)
  961.  
  962.  
  963.  
  964. Correct Correct
  965.  
  966.  
  967. 7. Which of the following General Functions will return the first non-null expression in the expression list? Mark for Review
  968. (1) Points
  969.  
  970.  
  971. NVL
  972.  
  973.  
  974. COALESCE (*)
  975.  
  976.  
  977. NVL2
  978.  
  979.  
  980. NULLIF
  981.  
  982.  
  983.  
  984. Incorrect Incorrect. Refer to Section 5 Lesson 2.
  985.  
  986.  
  987. 8. Which statement about group functions is true? Mark for Review
  988. (1) Points
  989.  
  990.  
  991. COALESCE, but not NVL and NVL2, can be used with group functions to replace null values.
  992.  
  993.  
  994. NVL and COALESCE, but not NVL2, can be used with group functions to replace null values.
  995.  
  996.  
  997. NVL, NVL2, and COALESCE can be used with group functions to replace null values. (*)
  998.  
  999.  
  1000. NVL and NVL2, but not COALESCE, can be used with group functions to replace null values.
  1001.  
  1002.  
  1003.  
  1004. Incorrect Incorrect. Refer to Section 5 Lesson 2.
  1005.  
  1006.  
  1007. 9. Consider the following data in the Employees table: (last_name, commission_pct, manager_id)
  1008. DATA:
  1009. King, null, null
  1010. Kochhar, null, 100
  1011. Vargas, null, 124
  1012. Zlotkey, .2, 100
  1013. What is the result of the following statement:
  1014. SELECT last_name, COALESCE(commission_pct, manager_id, -1) comm
  1015. FROM employees ;
  1016.  
  1017. Mark for Review
  1018. (1) Points
  1019.  
  1020.  
  1021. King, -1
  1022. Kochhar, 100
  1023. Vargas, 124
  1024. Zlotkey, .2
  1025. (*)
  1026.  
  1027.  
  1028.  
  1029. King, null
  1030. Kochhar, 100
  1031. Vargas, 124
  1032. Zlotkey, .2
  1033.  
  1034.  
  1035. King, -1
  1036. Kochhar, 100
  1037. Vargas, 124
  1038. Zlotkey, 100
  1039.  
  1040.  
  1041. Statement will fail
  1042.  
  1043.  
  1044.  
  1045. Incorrect Incorrect. Refer to Section 5 Lesson 2.
  1046.  
  1047.  
  1048. 10. The following statement returns 0 (zero). True or False?
  1049. SELECT 121/NULL
  1050. FROM dual; Mark for Review
  1051. (1) Points
  1052.  
  1053.  
  1054. True
  1055.  
  1056.  
  1057. False (*)
  1058.  
  1059.  
  1060.  
  1061. Incorrect Incorrect. Refer to Section 5 Lesson 2.
  1062.  
  1063. 11. When executed, which statement displays a zero if the TUITION_BALANCE value is zero and the HOUSING_BALANCE value is null? Mark for Review
  1064. (1) Points
  1065.  
  1066.  
  1067. SELECT NVL (tuition_balance + housing_balance, 0) "Balance Due"
  1068. FROM student_accounts;
  1069. (*)
  1070.  
  1071.  
  1072.  
  1073. SELECT tuition_balance + housing_balance
  1074. FROM student_accounts;
  1075.  
  1076.  
  1077. SELECT TO_NUMBER(tuition_balance, 0), TO_NUMBER (housing_balance, 0), tutition_balance + housing_balance "Balance Due"
  1078. FROM student_accounts;
  1079.  
  1080.  
  1081. SELECT NVL(tuition_balance, 0), NVL (housing_balance), tuition_balance + housing_balance "Balance Due"
  1082. FROM student_accounts;
  1083.  
  1084.  
  1085.  
  1086. Incorrect Incorrect. Refer to Section 5 Lesson 2.
  1087.  
  1088.  
  1089. 12. If quantity is a number datatype, what is the result of this statement?
  1090. SELECT NVL(200/quantity, 'zero') FROM inventory; Mark for Review
  1091. (1) Points
  1092.  
  1093.  
  1094. zero
  1095.  
  1096.  
  1097. Null
  1098.  
  1099.  
  1100. The statement fails (*)
  1101.  
  1102.  
  1103. ZERO
  1104.  
  1105.  
  1106.  
  1107. Incorrect Incorrect. Refer to Section 5 Lesson 2.
  1108.  
  1109.  
  1110. 13. For the given data from Employees (last_name, manager_id) what is the result of the following statement:
  1111. DATA:( King, null
  1112. Kochhar, 100
  1113. De Haan, 100
  1114. Hunold, 102
  1115. Ernst, 103)
  1116. SELECT last_name,
  1117. DECODE(manager_id, 100, 'King', 'A N Other') "Works For?"
  1118. FROM employees
  1119.  
  1120. Mark for Review
  1121. (1) Points
  1122.  
  1123.  
  1124. Invalid statement.
  1125.  
  1126.  
  1127. King, A N Other
  1128. Kochhar, King
  1129. De Haan, King
  1130. Hunold, A N Other
  1131. Ernst, A N Other
  1132. (*)
  1133.  
  1134.  
  1135.  
  1136. King, Null
  1137. Kochhar, King
  1138. De Haan, King
  1139. Hunold, A N Other
  1140. Ernst, A N Other
  1141.  
  1142.  
  1143. King, A N Other
  1144. Kochhar, King
  1145. De Haan, King
  1146. Hunold, Kochhar
  1147. Ernst, De Haan
  1148.  
  1149.  
  1150.  
  1151. Correct Correct
  1152.  
  1153.  
  1154. 14. Which statement will return a listing of last names, salaries, and a rating of 'Low', 'Medium', 'Good' or 'Excellent' depending on the salary value? Mark for Review
  1155. (1) Points
  1156.  
  1157.  
  1158. SELECT last_name,salary,
  1159. (CASE WHEN salary<5000 THEN 'Low'
  1160. WHEN salary<10000 THEN 'Medium'
  1161. WHEN salary<20000 THEN 'Good'
  1162. ELSE 'Excellent'
  1163. END) qualified_salary
  1164. FROM employees;
  1165. (*)
  1166.  
  1167.  
  1168.  
  1169. SELECT last_name,salary,
  1170. (CASE WHEN salary<5000 THEN 'Low'
  1171. WHEN sal <10000 THEN 'Medium'
  1172. WHEN sal <20000 THEN 'Good'
  1173. ELSE 'Excellent'
  1174. END) qualified_salary
  1175. FROM employees;
  1176.  
  1177.  
  1178. SELECT last_name,sal,
  1179. (CASE WHEN sal<5000 THEN 'Low'
  1180. WHEN sal<10000 THEN 'Medium'
  1181. WHEN sal<20000 THEN 'Good'
  1182. ELSE 'Excellent'
  1183. END) qualified_salary
  1184. FROM employees;
  1185.  
  1186.  
  1187. SELECT last_name,salary,
  1188. (RATING WHEN salary<5000 THEN 'Low'
  1189. WHEN salary<10000 THEN 'Medium'
  1190. WHEN salary<20000 THEN 'Good'
  1191. ELSE 'Excellent'
  1192. END) qualified_salary
  1193. FROM employees;
  1194.  
  1195.  
  1196.  
  1197. Incorrect Incorrect. Refer to Section 5 Lesson 3.
  1198.  
  1199.  
  1200. 15. CASE and DECODE evaluate expressions in a similar way to IF-THEN-ELSE logic. However, DECODE is specific to Oracle syntax. True or False? Mark for Review
  1201. (1) Points
  1202.  
  1203.  
  1204. True (*)
  1205.  
  1206.  
  1207. False
  1208.  
  1209.  
  1210.  
  1211. Incorrect Incorrect. Refer to Section 5 Lesson 3.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement