Advertisement
Guest User

Untitled

a guest
Feb 6th, 2013
7,252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.68 KB | None | 0 0
  1. Section 1
  2. (Answer all questions in this section)
  3.  
  4. 11. The EMPLOYEES table contains these columns:
  5. LAST_NAME VARCHAR2(20)
  6. FIRST_NAME VARCHAR2(20)
  7. HIRE_DATE DATE
  8. EVAL_MONTHS NUMBER(3)
  9.  
  10. Evaluate this SELECT statement:
  11.  
  12. SELECT hire_date + eval_months
  13. FROM employees;
  14.  
  15. The values returned by this SELECT statement will be of which data type?
  16.  
  17. Mark for Review
  18. (1) Points
  19.  
  20.  
  21. DATE (*)
  22.  
  23.  
  24. NUMBER
  25.  
  26.  
  27. DATETIME
  28.  
  29.  
  30. INTEGER
  31.  
  32.  
  33.  
  34. Correct
  35.  
  36.  
  37. 12. Which of the following SQL statements will correctly display the last name and the number of weeks employed for all employees in department 90? Mark for Review
  38. (1) Points
  39.  
  40.  
  41. SELECT last_name, (SYSDATE-hire_date)/7 AS WEEKS
  42. FROM employees
  43. WHERE department_id = 90;
  44. (*)
  45.  
  46.  
  47.  
  48. SELECT last name, (SYSDATE-hire_date)/7 DISPLAY WEEKS
  49. FROM employees
  50. WHERE department id = 90;
  51.  
  52.  
  53. SELECT last_name, # of WEEKS
  54. FROM employees
  55. WHERE department_id = 90;
  56.  
  57.  
  58. SELECT last_name, (SYSDATE-hire_date)AS WEEK
  59. FROM employees
  60. WHERE department_id = 90;
  61.  
  62.  
  63.  
  64. Correct
  65.  
  66.  
  67. 13. You want to create a report that displays all orders and their amounts that were placed during the month of January. You want the orders with the highest amounts to appear first. Which query should you issue? Mark for Review
  68. (1) Points
  69.  
  70.  
  71. SELECT orderid, total
  72. FROM orders
  73. WHERE order_date LIKE '01-jan-02' AND '31-jan-02'
  74. ORDER BY total DESC;
  75.  
  76.  
  77. SELECT orderid, total
  78. FROM orders
  79. WHERE order_date IN ( 01-jan-02 , 31-jan-02 )
  80. ORDER BY total;
  81.  
  82.  
  83. SELECT orderid, total
  84. FROM orders
  85. WHERE order_date BETWEEN '01-jan-02' AND '31-jan-02'
  86. ORDER BY total DESC;
  87. (*)
  88.  
  89.  
  90.  
  91. SELECT orderid, total
  92. FROM orders
  93. WHERE order_date BETWEEN '31-jan-02' AND '01-jan-02'
  94. ORDER BY total DESC;
  95.  
  96.  
  97.  
  98. Correct
  99.  
  100.  
  101. 14. Which script displays '01-MAY-04' when the HIRE_DATE value is '20-MAY-04'? Mark for Review
  102. (1) Points
  103.  
  104.  
  105. SELECT TRUNC(hire_date, 'MONTH')
  106. FROM employee;
  107. (*)
  108.  
  109.  
  110.  
  111. SELECT ROUND(hire_date, 'MONTH')
  112. FROM employee;
  113.  
  114.  
  115. SELECT ROUND(hire_date, 'MON')
  116. FROM employee;
  117.  
  118.  
  119. SELECT TRUNC(hire_date, 'MI')
  120. FROM employee;
  121.  
  122.  
  123.  
  124. Correct
  125.  
  126.  
  127. 15. You issue this SQL statement:
  128. SELECT TRUNC(751.367,-1) FROM dual;
  129. Which value does this statement display?
  130.  
  131. Mark for Review
  132. (1) Points
  133.  
  134.  
  135. 700
  136.  
  137.  
  138. 750 (*)
  139.  
  140.  
  141. 751
  142.  
  143.  
  144. 751.3
  145.  
  146.  
  147.  
  148. Correct
  149.  
  150.  
  151. 16. You issue this SQL statement:
  152. SELECT ROUND (1282.248, -2) FROM dual;
  153. What value does this statement produce?
  154.  
  155. Mark for Review
  156. (1) Points
  157.  
  158.  
  159. 1200
  160.  
  161.  
  162. 1282
  163.  
  164.  
  165. 1282.25
  166.  
  167.  
  168. 1300 (*)
  169.  
  170.  
  171.  
  172. Correct
  173.  
  174.  
  175.  
  176.  
  177. Section 4
  178. (Answer all questions in this section)
  179.  
  180. 17. Which statement about the COUNT function is true? Mark for Review
  181. (1) Points
  182.  
  183.  
  184. The COUNT function ignores duplicates by default.
  185.  
  186.  
  187. The COUNT function always ignores null values by default. (*)
  188.  
  189.  
  190. The COUNT function can be used to find the maximum value in each column.
  191.  
  192.  
  193. The COUNT function can be used to determine the number of unique, non-null values in a column.
  194.  
  195.  
  196.  
  197. Correct
  198.  
  199.  
  200. 18. Evaluate this SQL statement:
  201. SELECT COUNT (amount)
  202. FROM inventory;
  203.  
  204. What will occur when the statement is issued?
  205.  
  206. Mark for Review
  207. (1) Points
  208.  
  209.  
  210. The statement will return the greatest value in the INVENTORY table.
  211.  
  212.  
  213. The statement will return the total number of rows in the AMOUNT column.
  214.  
  215.  
  216. The statement will replace all NULL values that exist in the AMOUNT column.
  217.  
  218.  
  219. The statement will count the number of rows in the INVENTORY table where the AMOUNT column is not null. (*)
  220.  
  221.  
  222.  
  223. Correct
  224.  
  225.  
  226. 19. Evaluate this SELECT statement:
  227. SELECT COUNT(*)
  228. FROM products;
  229.  
  230. Which statement is true?
  231.  
  232. Mark for Review
  233. (1) Points
  234.  
  235.  
  236. The number of rows in the table is displayed. (*)
  237.  
  238.  
  239. The number of unique PRODUCT_IDs in the table is displayed.
  240.  
  241.  
  242. An error occurs due to an error in the SELECT clause.
  243.  
  244.  
  245. An error occurs because no WHERE clause is included in the SELECT statement.
  246.  
  247.  
  248.  
  249. Correct
  250.  
  251.  
  252. 20. Group functions can avoid computations involving duplicate values by including which keyword? Mark for Review
  253. (1) Points
  254.  
  255.  
  256. NULL
  257.  
  258.  
  259. DISTINCT (*)
  260.  
  261.  
  262. SELECT
  263.  
  264.  
  265. UNLIKE
  266.  
  267. Section 1
  268. (Answer all questions in this section)
  269.  
  270. 1. You need to display each employee's name in all uppercase letters. Which function should you use? Mark for Review
  271. (1) Points
  272.  
  273.  
  274. CASE
  275.  
  276.  
  277. UCASE
  278.  
  279.  
  280. UPPER (*)
  281.  
  282.  
  283. TOUPPER
  284.  
  285.  
  286.  
  287. Correct
  288.  
  289.  
  290. 2. Which SQL function can be used to remove heading or trailing characters (or both) from a character string? Mark for Review
  291. (1) Points
  292.  
  293.  
  294. LPAD
  295.  
  296.  
  297. CUT
  298.  
  299.  
  300. NVL2
  301.  
  302.  
  303. TRIM (*)
  304.  
  305.  
  306.  
  307. Incorrect. Refer to Section 1 Lesson 1.
  308.  
  309.  
  310. 3. Which SQL function is used to return the position where a specific character string begins within a larger character string? Mark for Review
  311. (1) Points
  312.  
  313.  
  314. CONCAT
  315.  
  316.  
  317. INSTR (*)
  318.  
  319.  
  320. LENGTH
  321.  
  322.  
  323. SUBSTR
  324.  
  325.  
  326.  
  327. Correct
  328.  
  329.  
  330. 4. You need to display the number of characters in each customer's last name. Which function should you use? Mark for Review
  331. (1) Points
  332.  
  333.  
  334. LENGTH (*)
  335.  
  336.  
  337. LPAD
  338.  
  339.  
  340. COUNT
  341.  
  342.  
  343. SUBSTR
  344.  
  345.  
  346.  
  347. Correct
  348.  
  349.  
  350. 5. The PRICE table contains this data:
  351. PRODUCT_ID MANUFACTURER_ID
  352. 86950 59604
  353.  
  354. You query the database and return the value 95. Which script did you use?
  355.  
  356. Mark for Review
  357. (1) Points
  358.  
  359.  
  360. SELECT SUBSTR(product_id, 3, 2)
  361. FROM price
  362. WHERE manufacturer_id = 59604;
  363. (*)
  364.  
  365.  
  366.  
  367. SELECT LENGTH(product_id, 3, 2)
  368. FROM price
  369. WHERE manufacturer_id = 59604;
  370.  
  371.  
  372. SELECT SUBSTR(product_id, -1, 3)
  373. FROM price
  374. WHERE manufacturer_id = 59604;
  375.  
  376.  
  377. SELECT TRIM(product_id, -3, 2)
  378. FROM price
  379. WHERE manufacturer_id = 59604;
  380.  
  381.  
  382.  
  383. Correct
  384.  
  385.  
  386. 6. You query the database with this SQL statement:
  387. SELECT CONCAT(last_name, (SUBSTR(LOWER(first_name), 4))) "Default Password"
  388. FROM employees;
  389.  
  390. Which function will be evaluated first?
  391.  
  392. Mark for Review
  393. (1) Points
  394.  
  395.  
  396. CONCAT
  397.  
  398.  
  399. SUBSTR
  400.  
  401.  
  402. LOWER (*)
  403.  
  404.  
  405. All three will be evaluated simultaneously.
  406.  
  407.  
  408.  
  409. Correct
  410.  
  411.  
  412. 7. You issue this SQL statement:
  413. SELECT INSTR ('organizational sales', 'al')
  414. FROM dual;
  415.  
  416. Which value is returned by this command?
  417.  
  418. Mark for Review
  419. (1) Points
  420.  
  421.  
  422. 1
  423.  
  424.  
  425. 2
  426.  
  427.  
  428. 13 (*)
  429.  
  430.  
  431. 17
  432.  
  433.  
  434.  
  435. Correct
  436.  
  437.  
  438. 8. Evaluate this SELECT statement:
  439. SELECT LENGTH(email)
  440. FROM employee;
  441.  
  442. What will this SELECT statement display?
  443.  
  444. Mark for Review
  445. (1) Points
  446.  
  447.  
  448. The longest e-mail address in the EMPLOYEE table
  449.  
  450.  
  451. The email address of each employee in the EMPLOYEE table
  452.  
  453.  
  454. The number of characters for each value in the EMAIL column in the employees table (*)
  455.  
  456.  
  457. The maximum number of characters allowed in the EMAIL column
  458.  
  459.  
  460.  
  461. Correct
  462.  
  463.  
  464. 9. You need to display the number of months between today's date and each employeeメs hiredate. Which function should you use? Mark for Review
  465. (1) Points
  466.  
  467.  
  468. ROUND
  469.  
  470.  
  471. BETWEEN
  472.  
  473.  
  474. ADD_MONTHS
  475.  
  476.  
  477. MONTHS_BETWEEN (*)
  478.  
  479.  
  480.  
  481. Correct
  482.  
  483.  
  484. 10. Evaluate this SELECT statement:
  485. SELECT SYSDATE + 30
  486. FROM dual;
  487.  
  488. Which value is returned by the query?
  489.  
  490. Mark for Review
  491. (1) Points
  492.  
  493.  
  494. The current date plus 30 hours.
  495.  
  496.  
  497. The current date plus 30 days. (*)
  498.  
  499.  
  500. The current date plus 30 months.
  501.  
  502.  
  503. No value is returned because the SELECT statement generates an error.
  504.  
  505.  
  506.  
  507. Correct
  508.  
  509. Section 4
  510. (Answer all questions in this section)
  511.  
  512. 21. Group functions return a value for ________________ and ________________ null values in their computations. Mark for Review
  513. (1) Points
  514.  
  515.  
  516. a row set, ignore (*)
  517.  
  518.  
  519. each row, ignore
  520.  
  521.  
  522. a row set, include
  523.  
  524.  
  525. each row, include
  526.  
  527.  
  528.  
  529. Correct
  530.  
  531.  
  532. 22. Which aggregate function can be used on a column of the DATE data type? Mark for Review
  533. (1) Points
  534.  
  535.  
  536. AVG
  537.  
  538.  
  539. MAX (*)
  540.  
  541.  
  542. STDDEV
  543.  
  544.  
  545. SUM
  546.  
  547.  
  548.  
  549. Correct
  550.  
  551.  
  552. 23. The AVG, SUM, VARIANCE, and STDDEV functions can be used with which of the following? Mark for Review
  553. (1) Points
  554.  
  555.  
  556. Only numeric data types (*)
  557.  
  558.  
  559. Integers only
  560.  
  561.  
  562. Any data type
  563.  
  564.  
  565. All except numeric
  566.  
  567.  
  568.  
  569. Correct
  570.  
  571.  
  572. 24. Which group functions below act on character, number and date data types? (Choose more than one answer) Mark for Review
  573. (1) Points
  574.  
  575. (Choose all correct answers)
  576.  
  577.  
  578. SUM
  579.  
  580.  
  581. MAX (*)
  582.  
  583.  
  584. MIN (*)
  585.  
  586.  
  587. AVG
  588.  
  589.  
  590. COUNT (*)
  591.  
  592.  
  593.  
  594. Correct
  595.  
  596.  
  597. 25. The VENDORS table contains these columns:
  598. VENDOR_ID NUMBER Primary Key
  599. NAME VARCHAR2(30)
  600. LOCATION_ID NUMBER
  601. ORDER_DT DATE
  602. ORDER_AMOUNT NUMBER(8,2)
  603.  
  604. Which two clauses represent valid uses of aggregate functions for this table?
  605.  
  606. Mark for Review
  607. (1) Points
  608.  
  609. (Choose all correct answers)
  610.  
  611.  
  612. FROM MAX(order_dt)
  613.  
  614.  
  615. SELECT SUM(order_dt)
  616.  
  617.  
  618. SELECT SUM(order_amount) (*)
  619.  
  620.  
  621. WHERE MAX(order_dt) = order_dt
  622.  
  623.  
  624. SELECT MIN(AVG(order_amount)) (*)
  625.  
  626.  
  627.  
  628. Incorrect. Refer to Section 4 Lesson 2.
  629.  
  630.  
  631. 26. Which group function would you use to display the highest salary value in the EMPLOYEES table? Mark for Review
  632. (1) Points
  633.  
  634.  
  635. AVG
  636.  
  637.  
  638. COUNT
  639.  
  640.  
  641. MAX (*)
  642.  
  643.  
  644. MIN
  645.  
  646.  
  647.  
  648. Correct
  649.  
  650.  
  651. 27. You need to compute the total salary for all employees in department 10. Which group function will you use? Mark for Review
  652. (1) Points
  653.  
  654.  
  655. MAX
  656.  
  657.  
  658. SUM (*)
  659.  
  660.  
  661. VARIANCE
  662.  
  663.  
  664. COUNT
  665.  
  666.  
  667.  
  668. Correct
  669.  
  670.  
  671.  
  672.  
  673. Section 2
  674. (Answer all questions in this section)
  675.  
  676. 28. A correlated subquery is evaluated _____ for each row processed by the parent statement. Mark for Review
  677. (1) Points
  678.  
  679.  
  680. EVERY TIME
  681.  
  682.  
  683. ONCE (*)
  684.  
  685.  
  686. COMPLETELY
  687.  
  688.  
  689.  
  690. Correct
  691.  
  692.  
  693. 29. The WITH clause enables a SELECT statement to define the subquery block at the start of the query, process the block just once, label the results, and then refer to the results multiple times. True or False? Mark for Review
  694. (1) Points
  695.  
  696.  
  697. True (*)
  698.  
  699.  
  700. False
  701.  
  702.  
  703.  
  704. Correct
  705.  
  706.  
  707. 30. Which statement is false? Mark for Review
  708. (1) Points
  709.  
  710.  
  711. The WITH clause retrieves the results of one or more query blocks
  712.  
  713.  
  714. The WITH clause decreases performance (*)
  715.  
  716.  
  717. The WITH clause makes the query simple to read
  718.  
  719.  
  720. The WITH clause stores the results for the user who runs the query
  721.  
  722.  
  723.  
  724. Correct
  725.  
  726. Section 2
  727. (Answer all questions in this section)
  728.  
  729. 31. A correlated subquery will _______ a candidate row from an outer query, _______ the inner query using candidate row value, and _______ values from the inner query to qualify or disqualify the candidate row. Mark for Review
  730. (1) Points
  731.  
  732.  
  733. CREATE; EXECUTE; USE
  734.  
  735.  
  736. DELETE; UPDATE; INSERT
  737.  
  738.  
  739. GET; EXECUTE; USE (*)
  740.  
  741.  
  742. ROLLUP; GRANT; DROP
  743.  
  744.  
  745.  
  746. Correct
  747.  
  748.  
  749. 32. Which three statements concerning explicit data type conversions are true? (Choose three.) Mark for Review
  750. (1) Points
  751.  
  752. (Choose all correct answers)
  753.  
  754.  
  755. Use the TO_NUMBER function to convert a number to a character string.
  756.  
  757.  
  758. Use the TO_DATE function to convert a character string to a date value. (*)
  759.  
  760.  
  761. Use the TO_NUMBER function to convert a character string of digits to a number. (*)
  762.  
  763.  
  764. Use the TO_DATE function to convert a date value to character string or number.
  765.  
  766.  
  767. Use the TO_CHAR function to convert a number or date value to character string. (*)
  768.  
  769.  
  770.  
  771. Correct
  772.  
  773.  
  774. 33. Which functions allow you to perform explicit data type conversions? Mark for Review
  775. (1) Points
  776.  
  777.  
  778. ROUND, TRUNC, ADD_MONTHS
  779.  
  780.  
  781. LENGTH, SUBSTR, LPAD, TRIM
  782.  
  783.  
  784. TO_CHAR, TO_DATE, TO_NUMBER (*)
  785.  
  786.  
  787. NVL, NVL2, NULLIF
  788.  
  789.  
  790.  
  791. Correct
  792.  
  793.  
  794. 34. The EMPLOYEES table contains these columns:
  795. EMPLOYEE_ID NUMBER(9)
  796. LAST_NAME VARCHAR2 (25)
  797. FIRST_NAME VARCHAR2 (25)
  798. SALARY NUMBER(6)
  799. You need to create a report to display the salaries of all employees. Which script should you use to display the salaries in format: "$45,000.00"?
  800.  
  801. Mark for Review
  802. (1) Points
  803.  
  804.  
  805. SELECT TO_CHAR(salary, '$999,999')
  806. FROM employees;
  807.  
  808.  
  809. SELECT TO_NUM(salary, '$999,990.99')
  810. FROM employees;
  811.  
  812.  
  813. SELECT TO_NUM(salary, '$999,999.00')
  814. FROM employees;
  815.  
  816.  
  817. SELECT TO_CHAR(salary, '$999,999.00')
  818. FROM employees;
  819. (*)
  820.  
  821.  
  822.  
  823.  
  824. Correct
  825.  
  826.  
  827. 35. Which arithmetic operation will return a numeric value? Mark for Review
  828. (1) Points
  829.  
  830.  
  831. TO_DATE('01-JUN-2004') - TO_DATE('01-OCT-2004') (*)
  832.  
  833.  
  834. NEXT_DAY(hire_date) + 5
  835.  
  836.  
  837. SYSDATE - 6
  838.  
  839.  
  840. SYSDATE + 30 / 24
  841.  
  842.  
  843.  
  844. Correct
  845.  
  846.  
  847. 36. Which two statements concerning SQL functions are true? (Choose two.) Mark for Review
  848. (1) Points
  849.  
  850. (Choose all correct answers)
  851.  
  852.  
  853. Character functions can accept numeric input.
  854.  
  855.  
  856. Not all date functions return date values. (*)
  857.  
  858.  
  859. Number functions can return number or character values.
  860.  
  861.  
  862. Conversion functions convert a value from one data type to another data type. (*)
  863.  
  864.  
  865. Single-row functions manipulate groups of rows to return one result per group of rows.
  866.  
  867.  
  868.  
  869. Correct
  870.  
  871.  
  872. 37. The EMPLOYEES table contains these columns:
  873. EMPLOYEE_ID NUMBER(9)
  874. LAST_NAME VARCHAR2 (25)
  875. FIRST_NAME VARCHAR2 (25)
  876. HIRE_DATE DATE
  877.  
  878. You need to display HIRE_DATE values in this format:
  879.  
  880. January 28, 2000
  881.  
  882. Which SELECT statement could you use?
  883.  
  884. Mark for Review
  885. (1) Points
  886.  
  887.  
  888. SELECT TO_CHAR(hire_date, Month DD, YYYY)
  889. FROM employees;
  890.  
  891.  
  892. SELECT TO_CHAR(hire_date, 'Month DD, YYYY')
  893. FROM employees;
  894. (*)
  895.  
  896.  
  897.  
  898. SELECT hire_date(TO_CHAR 'Month DD', ' YYYY')
  899. FROM employees;
  900.  
  901.  
  902. SELECT TO_CHAR(hire_date, 'Month DD', ' YYYY')
  903. FROM employees;
  904.  
  905.  
  906.  
  907. Correct
  908.  
  909.  
  910.  
  911.  
  912. Section 3
  913. (Answer all questions in this section)
  914.  
  915. 38. Which statement about a self join is true? Mark for Review
  916. (1) Points
  917.  
  918.  
  919. The NATURAL JOIN clause must be used.
  920.  
  921.  
  922. Table aliases must be used to qualify table names. (*)
  923.  
  924.  
  925. Table aliases cannot be used to qualify table names.
  926.  
  927.  
  928. A self join must be implemented by defining a view.
  929.  
  930.  
  931.  
  932. Incorrect. Refer to Section 3 Lesson 4.
  933.  
  934.  
  935. 39. Which SELECT statement implements a self join? Mark for Review
  936. (1) Points
  937.  
  938.  
  939. SELECT p.part_id, t.product_id
  940. FROM part p, part t
  941. WHERE p.part_id = t.product_id;
  942. (*)
  943.  
  944.  
  945.  
  946. SELECT p.part_id, t.product_id
  947. FROM part p, product t
  948. WHERE p.part_id = t.product_id;
  949.  
  950.  
  951. SELECT p.part_id, t.product_id
  952. FROM part p, product t
  953. WHERE p.part_id = t.product_id (+);
  954.  
  955.  
  956. SELECT p.part_id, t.product_id
  957. FROM part p, product t
  958. WHERE p.part_id =! t.product_id;
  959.  
  960.  
  961.  
  962. Incorrect. Refer to Section 3 Lesson 4.
  963.  
  964.  
  965. 40. Evaluate this SELECT statement:
  966. SELECT *
  967. FROM employee e, employee m
  968. WHERE e.mgr_id = m.emp_id;
  969. Which type of join is created by this SELECT statement?
  970.  
  971. Mark for Review
  972. (1) Points
  973.  
  974.  
  975. a self join (*)
  976.  
  977.  
  978. a cross join
  979.  
  980.  
  981. a left outer join
  982.  
  983.  
  984. a full outer join
  985.  
  986.  
  987.  
  988. Correct
  989. Section 3
  990. (Answer all questions in this section)
  991.  
  992. 41. Which type of join returns rows from one table that have NO direct match in the other table? Mark for Review
  993. (1) Points
  994.  
  995.  
  996. Equijoin
  997.  
  998.  
  999. Self join
  1000.  
  1001.  
  1002. Outer join (*)
  1003.  
  1004.  
  1005. Natural join
  1006.  
  1007.  
  1008.  
  1009. Correct
  1010.  
  1011.  
  1012. 42. You need to join the EMPLOYEE_HIST and EMPLOYEES tables. The EMPLOYEE_HIST table will be the first table in the FROM clause. All the matched and unmatched rows in the EMPLOYEES table need to be displayed. Which type of join will you use? Mark for Review
  1013. (1) Points
  1014.  
  1015.  
  1016. A cross join
  1017.  
  1018.  
  1019. An inner join
  1020.  
  1021.  
  1022. A left outer join
  1023.  
  1024.  
  1025. A right outer join (*)
  1026.  
  1027.  
  1028.  
  1029. Incorrect. Refer to Section 3 Lesson 3.
  1030.  
  1031.  
  1032. 43. Which two sets of join keywords create a join that will include unmatched rows from the first table specified in the SELECT statement? Mark for Review
  1033. (1) Points
  1034.  
  1035.  
  1036. LEFT OUTER JOIN and FULL OUTER JOIN (*)
  1037.  
  1038.  
  1039. RIGHT OUTER JOIN and LEFT OUTER JOIN
  1040.  
  1041.  
  1042. USING and HAVING
  1043.  
  1044.  
  1045. OUTER JOIN and USING
  1046.  
  1047.  
  1048.  
  1049. Correct
  1050.  
  1051.  
  1052. 44. Below find the structures of the PRODUCTS and VENDORS tables:
  1053. PRODUCTS
  1054. PRODUCT_ID NUMBER
  1055. PRODUCT_NAME VARCHAR2 (25)
  1056. VENDOR_ID NUMBER
  1057. CATEGORY_ID NUMBER
  1058.  
  1059. VENDORS
  1060. VENDOR_ID NUMBER
  1061. VENDOR_NAME VARCHAR2 (25)
  1062. ADDRESS VARCHAR2 (30)
  1063. CITY VARCHAR2 (25)
  1064. REGION VARCHAR2 (10)
  1065. POSTAL_CODE VARCHAR2 (11)
  1066.  
  1067. You want to create a query that will return an alphabetical list of products, including the product name and associated vendor name, for all products that have a vendor assigned. Which two queries could you use?
  1068.  
  1069. Mark for Review
  1070. (1) Points
  1071.  
  1072. (Choose all correct answers)
  1073.  
  1074.  
  1075. SELECT p.product_name, v.vendor_name
  1076. FROM products p
  1077. LEFT OUTER JOIN vendors v
  1078. ON p.vendor_id = v.vendor_id
  1079. ORDER BY p.product_name;
  1080.  
  1081.  
  1082. SELECT p.product_name, v.vendor_name
  1083. FROM products p
  1084. JOIN vendors v
  1085. ON (vendor_id)
  1086. ORDER BY p.product_name;
  1087.  
  1088.  
  1089. SELECT p.product_name, v.vendor_name
  1090. FROM products p
  1091. NATURAL JOIN vendors v
  1092. ORDER BY p.product_name;
  1093. (*)
  1094.  
  1095.  
  1096.  
  1097. SELECT p.product_name, v.vendor_name
  1098. FROM products p
  1099. JOIN vendors v
  1100. USING (p.vendor_id)
  1101. ORDER BY p.product_name;
  1102.  
  1103.  
  1104. SELECT p.product_name, v.vendor_name
  1105. FROM products p
  1106. JOIN vendors v
  1107. USING (vendor_id)
  1108. ORDER BY p.product_name;
  1109. (*)
  1110.  
  1111.  
  1112.  
  1113.  
  1114. Incorrect. Refer to Section 3 Lesson 2.
  1115.  
  1116.  
  1117. 45. The primary advantages of using JOIN ON is: (Select two) Mark for Review
  1118. (1) Points
  1119.  
  1120. (Choose all correct answers)
  1121.  
  1122.  
  1123. The join happens automatically based on matching column names and data types.
  1124.  
  1125.  
  1126. It will display rows that do not meet the join condition.
  1127.  
  1128.  
  1129. It permits columns with different names to be joined. (*)
  1130.  
  1131.  
  1132. It permits columns that donメt have matching data types to be joined. (*)
  1133.  
  1134.  
  1135.  
  1136. Correct
  1137.  
  1138.  
  1139. 46. Which of the following statements is the simplest description of a nonequijoin? Mark for Review
  1140. (1) Points
  1141.  
  1142.  
  1143. A join condition containing something other than an equality operator (*)
  1144.  
  1145.  
  1146. A join condition that is not equal to other joins.
  1147.  
  1148.  
  1149. A join condition that includes the (+) on the left hand side.
  1150.  
  1151.  
  1152. A join that joins a table to itself
  1153.  
  1154.  
  1155.  
  1156. Correct
  1157.  
  1158.  
  1159. 47. Which keyword in a SELECT statement creates an equijoin by specifying a column name common to both tables? Mark for Review
  1160. (1) Points
  1161.  
  1162.  
  1163. A HAVING clause
  1164.  
  1165.  
  1166. The FROM clause
  1167.  
  1168.  
  1169. The SELECT clause
  1170.  
  1171.  
  1172. A USING clause (*)
  1173.  
  1174.  
  1175.  
  1176. Correct
  1177.  
  1178.  
  1179. 48. Evaluate this SELECT statement:
  1180. SELECT a.lname || ', ' || a.fname as "Patient", b.lname || ', ' || b.fname as "Physician", c.admission
  1181. FROM patient a
  1182. JOIN physician b
  1183. ON (b.physician_id = c.physician_id)
  1184. JOIN admission c
  1185. ON (a.patient_id = c.patient_id);
  1186.  
  1187. Which clause generates an error?
  1188.  
  1189. Mark for Review
  1190. (1) Points
  1191.  
  1192.  
  1193. JOIN physician b
  1194.  
  1195.  
  1196. ON (b.physician_id = c.physician_id); (*)
  1197.  
  1198.  
  1199. JOIN admission c
  1200.  
  1201.  
  1202. ON (a.patient_id = c.patient_id)
  1203.  
  1204.  
  1205.  
  1206. Incorrect. Refer to Section 3 Lesson 2.
  1207.  
  1208.  
  1209. 49. For which condition would you use an equijoin query with the USING keyword? Mark for Review
  1210. (1) Points
  1211.  
  1212.  
  1213. You need to perform a join of the CUSTOMER and ORDER tables but limit the number of columns in the join condition. (*)
  1214.  
  1215.  
  1216. The ORDER table contains a column that has a referential constraint to a column in the PRODUCT table.
  1217.  
  1218.  
  1219. The CUSTOMER and ORDER tables have no columns with identical names.
  1220.  
  1221.  
  1222. The CUSTOMER and ORDER tables have a corresponding column, CUST_ID. The CUST_ID column in the ORDER table contains null values that need to be displayed.
  1223.  
  1224.  
  1225.  
  1226. Correct
  1227.  
  1228.  
  1229. 50. You created the CUSTOMERS and ORDERS tables by issuing these CREATE TABLE statements in sequence:
  1230. CREATE TABLE customers
  1231. (custid varchar2(5),
  1232. companyname varchar2(30),
  1233. contactname varchar2(30),
  1234. address varchar2(30),
  1235. city varchar2(20),
  1236. state varchar2(30),
  1237. phone varchar2(20),
  1238. constraint pk_customers_01 primary key (custid));
  1239.  
  1240. CREATE TABLE orders
  1241. (orderid varchar2(5) constraint pk_orders_01 primary key,
  1242. orderdate date,
  1243. total number(15),
  1244. custid varchar2(5) references customers (custid));
  1245.  
  1246. You have been instructed to compile a report to present the information about orders placed by customers who reside in Nashville. Which query should you issue to achieve the desired results?
  1247.  
  1248. Mark for Review
  1249. (1) Points
  1250.  
  1251.  
  1252. SELECT custid, companyname
  1253. FROM customers
  1254. WHERE city = 'Nashville';
  1255.  
  1256.  
  1257. SELECT orderid, orderdate, total
  1258. FROM orders o
  1259. NATURAL JOIN customers c ON o.custid = c.custid
  1260. WHERE city = 'Nashville';
  1261.  
  1262.  
  1263. SELECT orderid, orderdate, total
  1264. FROM orders o
  1265. JOIN customers c ON o.custid = c.custid
  1266. WHERE city = 'Nashville';
  1267. (*)
  1268.  
  1269.  
  1270.  
  1271. SELECT orderid, orderdate, total
  1272. FROM orders
  1273. WHERE city = 'Nashville';
  1274.  
  1275.  
  1276.  
  1277. Incorrect. Refer to Section 3 Lesson 2.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement