Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Section 1
- (Answer all questions in this section)
- 11. The EMPLOYEES table contains these columns:
- LAST_NAME VARCHAR2(20)
- FIRST_NAME VARCHAR2(20)
- HIRE_DATE DATE
- EVAL_MONTHS NUMBER(3)
- Evaluate this SELECT statement:
- SELECT hire_date + eval_months
- FROM employees;
- The values returned by this SELECT statement will be of which data type?
- Mark for Review
- (1) Points
- DATE (*)
- NUMBER
- DATETIME
- INTEGER
- Correct
- 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
- (1) Points
- SELECT last_name, (SYSDATE-hire_date)/7 AS WEEKS
- FROM employees
- WHERE department_id = 90;
- (*)
- SELECT last name, (SYSDATE-hire_date)/7 DISPLAY WEEKS
- FROM employees
- WHERE department id = 90;
- SELECT last_name, # of WEEKS
- FROM employees
- WHERE department_id = 90;
- SELECT last_name, (SYSDATE-hire_date)AS WEEK
- FROM employees
- WHERE department_id = 90;
- Correct
- 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
- (1) Points
- SELECT orderid, total
- FROM orders
- WHERE order_date LIKE '01-jan-02' AND '31-jan-02'
- ORDER BY total DESC;
- SELECT orderid, total
- FROM orders
- WHERE order_date IN ( 01-jan-02 , 31-jan-02 )
- ORDER BY total;
- SELECT orderid, total
- FROM orders
- WHERE order_date BETWEEN '01-jan-02' AND '31-jan-02'
- ORDER BY total DESC;
- (*)
- SELECT orderid, total
- FROM orders
- WHERE order_date BETWEEN '31-jan-02' AND '01-jan-02'
- ORDER BY total DESC;
- Correct
- 14. Which script displays '01-MAY-04' when the HIRE_DATE value is '20-MAY-04'? Mark for Review
- (1) Points
- SELECT TRUNC(hire_date, 'MONTH')
- FROM employee;
- (*)
- SELECT ROUND(hire_date, 'MONTH')
- FROM employee;
- SELECT ROUND(hire_date, 'MON')
- FROM employee;
- SELECT TRUNC(hire_date, 'MI')
- FROM employee;
- Correct
- 15. You issue this SQL statement:
- SELECT TRUNC(751.367,-1) FROM dual;
- Which value does this statement display?
- Mark for Review
- (1) Points
- 700
- 750 (*)
- 751
- 751.3
- Correct
- 16. You issue this SQL statement:
- SELECT ROUND (1282.248, -2) FROM dual;
- What value does this statement produce?
- Mark for Review
- (1) Points
- 1200
- 1282
- 1282.25
- 1300 (*)
- Correct
- Section 4
- (Answer all questions in this section)
- 17. Which statement about the COUNT function is true? Mark for Review
- (1) Points
- The COUNT function ignores duplicates by default.
- The COUNT function always ignores null values by default. (*)
- The COUNT function can be used to find the maximum value in each column.
- The COUNT function can be used to determine the number of unique, non-null values in a column.
- Correct
- 18. Evaluate this SQL statement:
- SELECT COUNT (amount)
- FROM inventory;
- What will occur when the statement is issued?
- Mark for Review
- (1) Points
- The statement will return the greatest value in the INVENTORY table.
- The statement will return the total number of rows in the AMOUNT column.
- The statement will replace all NULL values that exist in the AMOUNT column.
- The statement will count the number of rows in the INVENTORY table where the AMOUNT column is not null. (*)
- Correct
- 19. Evaluate this SELECT statement:
- SELECT COUNT(*)
- FROM products;
- Which statement is true?
- Mark for Review
- (1) Points
- The number of rows in the table is displayed. (*)
- The number of unique PRODUCT_IDs in the table is displayed.
- An error occurs due to an error in the SELECT clause.
- An error occurs because no WHERE clause is included in the SELECT statement.
- Correct
- 20. Group functions can avoid computations involving duplicate values by including which keyword? Mark for Review
- (1) Points
- NULL
- DISTINCT (*)
- SELECT
- UNLIKE
- Section 1
- (Answer all questions in this section)
- 1. You need to display each employee's name in all uppercase letters. Which function should you use? Mark for Review
- (1) Points
- CASE
- UCASE
- UPPER (*)
- TOUPPER
- Correct
- 2. Which SQL function can be used to remove heading or trailing characters (or both) from a character string? Mark for Review
- (1) Points
- LPAD
- CUT
- NVL2
- TRIM (*)
- Incorrect. Refer to Section 1 Lesson 1.
- 3. Which SQL function is used to return the position where a specific character string begins within a larger character string? Mark for Review
- (1) Points
- CONCAT
- INSTR (*)
- LENGTH
- SUBSTR
- Correct
- 4. You need to display the number of characters in each customer's last name. Which function should you use? Mark for Review
- (1) Points
- LENGTH (*)
- LPAD
- COUNT
- SUBSTR
- Correct
- 5. The PRICE table contains this data:
- PRODUCT_ID MANUFACTURER_ID
- 86950 59604
- You query the database and return the value 95. Which script did you use?
- Mark for Review
- (1) Points
- SELECT SUBSTR(product_id, 3, 2)
- FROM price
- WHERE manufacturer_id = 59604;
- (*)
- SELECT LENGTH(product_id, 3, 2)
- FROM price
- WHERE manufacturer_id = 59604;
- SELECT SUBSTR(product_id, -1, 3)
- FROM price
- WHERE manufacturer_id = 59604;
- SELECT TRIM(product_id, -3, 2)
- FROM price
- WHERE manufacturer_id = 59604;
- Correct
- 6. You query the database with this SQL statement:
- SELECT CONCAT(last_name, (SUBSTR(LOWER(first_name), 4))) "Default Password"
- FROM employees;
- Which function will be evaluated first?
- Mark for Review
- (1) Points
- CONCAT
- SUBSTR
- LOWER (*)
- All three will be evaluated simultaneously.
- Correct
- 7. You issue this SQL statement:
- SELECT INSTR ('organizational sales', 'al')
- FROM dual;
- Which value is returned by this command?
- Mark for Review
- (1) Points
- 1
- 2
- 13 (*)
- 17
- Correct
- 8. Evaluate this SELECT statement:
- SELECT LENGTH(email)
- FROM employee;
- What will this SELECT statement display?
- Mark for Review
- (1) Points
- The longest e-mail address in the EMPLOYEE table
- The email address of each employee in the EMPLOYEE table
- The number of characters for each value in the EMAIL column in the employees table (*)
- The maximum number of characters allowed in the EMAIL column
- Correct
- 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
- (1) Points
- ROUND
- BETWEEN
- ADD_MONTHS
- MONTHS_BETWEEN (*)
- Correct
- 10. Evaluate this SELECT statement:
- SELECT SYSDATE + 30
- FROM dual;
- Which value is returned by the query?
- Mark for Review
- (1) Points
- The current date plus 30 hours.
- The current date plus 30 days. (*)
- The current date plus 30 months.
- No value is returned because the SELECT statement generates an error.
- Correct
- Section 4
- (Answer all questions in this section)
- 21. Group functions return a value for ________________ and ________________ null values in their computations. Mark for Review
- (1) Points
- a row set, ignore (*)
- each row, ignore
- a row set, include
- each row, include
- Correct
- 22. Which aggregate function can be used on a column of the DATE data type? Mark for Review
- (1) Points
- AVG
- MAX (*)
- STDDEV
- SUM
- Correct
- 23. The AVG, SUM, VARIANCE, and STDDEV functions can be used with which of the following? Mark for Review
- (1) Points
- Only numeric data types (*)
- Integers only
- Any data type
- All except numeric
- Correct
- 24. Which group functions below act on character, number and date data types? (Choose more than one answer) Mark for Review
- (1) Points
- (Choose all correct answers)
- SUM
- MAX (*)
- MIN (*)
- AVG
- COUNT (*)
- Correct
- 25. The VENDORS table contains these columns:
- VENDOR_ID NUMBER Primary Key
- NAME VARCHAR2(30)
- LOCATION_ID NUMBER
- ORDER_DT DATE
- ORDER_AMOUNT NUMBER(8,2)
- Which two clauses represent valid uses of aggregate functions for this table?
- Mark for Review
- (1) Points
- (Choose all correct answers)
- FROM MAX(order_dt)
- SELECT SUM(order_dt)
- SELECT SUM(order_amount) (*)
- WHERE MAX(order_dt) = order_dt
- SELECT MIN(AVG(order_amount)) (*)
- Incorrect. Refer to Section 4 Lesson 2.
- 26. Which group function would you use to display the highest salary value in the EMPLOYEES table? Mark for Review
- (1) Points
- AVG
- COUNT
- MAX (*)
- MIN
- Correct
- 27. You need to compute the total salary for all employees in department 10. Which group function will you use? Mark for Review
- (1) Points
- MAX
- SUM (*)
- VARIANCE
- COUNT
- Correct
- Section 2
- (Answer all questions in this section)
- 28. A correlated subquery is evaluated _____ for each row processed by the parent statement. Mark for Review
- (1) Points
- EVERY TIME
- ONCE (*)
- COMPLETELY
- Correct
- 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
- (1) Points
- True (*)
- False
- Correct
- 30. Which statement is false? Mark for Review
- (1) Points
- The WITH clause retrieves the results of one or more query blocks
- The WITH clause decreases performance (*)
- The WITH clause makes the query simple to read
- The WITH clause stores the results for the user who runs the query
- Correct
- Section 2
- (Answer all questions in this section)
- 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
- (1) Points
- CREATE; EXECUTE; USE
- DELETE; UPDATE; INSERT
- GET; EXECUTE; USE (*)
- ROLLUP; GRANT; DROP
- Correct
- 32. Which three statements concerning explicit data type conversions are true? (Choose three.) Mark for Review
- (1) Points
- (Choose all correct answers)
- Use the TO_NUMBER function to convert a number to a character string.
- Use the TO_DATE function to convert a character string to a date value. (*)
- Use the TO_NUMBER function to convert a character string of digits to a number. (*)
- Use the TO_DATE function to convert a date value to character string or number.
- Use the TO_CHAR function to convert a number or date value to character string. (*)
- Correct
- 33. Which functions allow you to perform explicit data type conversions? Mark for Review
- (1) Points
- ROUND, TRUNC, ADD_MONTHS
- LENGTH, SUBSTR, LPAD, TRIM
- TO_CHAR, TO_DATE, TO_NUMBER (*)
- NVL, NVL2, NULLIF
- Correct
- 34. The EMPLOYEES table contains these columns:
- EMPLOYEE_ID NUMBER(9)
- LAST_NAME VARCHAR2 (25)
- FIRST_NAME VARCHAR2 (25)
- SALARY NUMBER(6)
- 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"?
- Mark for Review
- (1) Points
- SELECT TO_CHAR(salary, '$999,999')
- FROM employees;
- SELECT TO_NUM(salary, '$999,990.99')
- FROM employees;
- SELECT TO_NUM(salary, '$999,999.00')
- FROM employees;
- SELECT TO_CHAR(salary, '$999,999.00')
- FROM employees;
- (*)
- Correct
- 35. Which arithmetic operation will return a numeric value? Mark for Review
- (1) Points
- TO_DATE('01-JUN-2004') - TO_DATE('01-OCT-2004') (*)
- NEXT_DAY(hire_date) + 5
- SYSDATE - 6
- SYSDATE + 30 / 24
- Correct
- 36. Which two statements concerning SQL functions are true? (Choose two.) Mark for Review
- (1) Points
- (Choose all correct answers)
- Character functions can accept numeric input.
- Not all date functions return date values. (*)
- Number functions can return number or character values.
- Conversion functions convert a value from one data type to another data type. (*)
- Single-row functions manipulate groups of rows to return one result per group of rows.
- Correct
- 37. The EMPLOYEES table contains these columns:
- EMPLOYEE_ID NUMBER(9)
- LAST_NAME VARCHAR2 (25)
- FIRST_NAME VARCHAR2 (25)
- HIRE_DATE DATE
- You need to display HIRE_DATE values in this format:
- January 28, 2000
- Which SELECT statement could you use?
- Mark for Review
- (1) Points
- SELECT TO_CHAR(hire_date, Month DD, YYYY)
- FROM employees;
- SELECT TO_CHAR(hire_date, 'Month DD, YYYY')
- FROM employees;
- (*)
- SELECT hire_date(TO_CHAR 'Month DD', ' YYYY')
- FROM employees;
- SELECT TO_CHAR(hire_date, 'Month DD', ' YYYY')
- FROM employees;
- Correct
- Section 3
- (Answer all questions in this section)
- 38. Which statement about a self join is true? Mark for Review
- (1) Points
- The NATURAL JOIN clause must be used.
- Table aliases must be used to qualify table names. (*)
- Table aliases cannot be used to qualify table names.
- A self join must be implemented by defining a view.
- Incorrect. Refer to Section 3 Lesson 4.
- 39. Which SELECT statement implements a self join? Mark for Review
- (1) Points
- SELECT p.part_id, t.product_id
- FROM part p, part t
- WHERE p.part_id = t.product_id;
- (*)
- SELECT p.part_id, t.product_id
- FROM part p, product t
- WHERE p.part_id = t.product_id;
- SELECT p.part_id, t.product_id
- FROM part p, product t
- WHERE p.part_id = t.product_id (+);
- SELECT p.part_id, t.product_id
- FROM part p, product t
- WHERE p.part_id =! t.product_id;
- Incorrect. Refer to Section 3 Lesson 4.
- 40. Evaluate this SELECT statement:
- SELECT *
- FROM employee e, employee m
- WHERE e.mgr_id = m.emp_id;
- Which type of join is created by this SELECT statement?
- Mark for Review
- (1) Points
- a self join (*)
- a cross join
- a left outer join
- a full outer join
- Correct
- Section 3
- (Answer all questions in this section)
- 41. Which type of join returns rows from one table that have NO direct match in the other table? Mark for Review
- (1) Points
- Equijoin
- Self join
- Outer join (*)
- Natural join
- Correct
- 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
- (1) Points
- A cross join
- An inner join
- A left outer join
- A right outer join (*)
- Incorrect. Refer to Section 3 Lesson 3.
- 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
- (1) Points
- LEFT OUTER JOIN and FULL OUTER JOIN (*)
- RIGHT OUTER JOIN and LEFT OUTER JOIN
- USING and HAVING
- OUTER JOIN and USING
- Correct
- 44. Below find the structures of the PRODUCTS and VENDORS tables:
- PRODUCTS
- PRODUCT_ID NUMBER
- PRODUCT_NAME VARCHAR2 (25)
- VENDOR_ID NUMBER
- CATEGORY_ID NUMBER
- VENDORS
- VENDOR_ID NUMBER
- VENDOR_NAME VARCHAR2 (25)
- ADDRESS VARCHAR2 (30)
- CITY VARCHAR2 (25)
- REGION VARCHAR2 (10)
- POSTAL_CODE VARCHAR2 (11)
- 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?
- Mark for Review
- (1) Points
- (Choose all correct answers)
- SELECT p.product_name, v.vendor_name
- FROM products p
- LEFT OUTER JOIN vendors v
- ON p.vendor_id = v.vendor_id
- ORDER BY p.product_name;
- SELECT p.product_name, v.vendor_name
- FROM products p
- JOIN vendors v
- ON (vendor_id)
- ORDER BY p.product_name;
- SELECT p.product_name, v.vendor_name
- FROM products p
- NATURAL JOIN vendors v
- ORDER BY p.product_name;
- (*)
- SELECT p.product_name, v.vendor_name
- FROM products p
- JOIN vendors v
- USING (p.vendor_id)
- ORDER BY p.product_name;
- SELECT p.product_name, v.vendor_name
- FROM products p
- JOIN vendors v
- USING (vendor_id)
- ORDER BY p.product_name;
- (*)
- Incorrect. Refer to Section 3 Lesson 2.
- 45. The primary advantages of using JOIN ON is: (Select two) Mark for Review
- (1) Points
- (Choose all correct answers)
- The join happens automatically based on matching column names and data types.
- It will display rows that do not meet the join condition.
- It permits columns with different names to be joined. (*)
- It permits columns that donメt have matching data types to be joined. (*)
- Correct
- 46. Which of the following statements is the simplest description of a nonequijoin? Mark for Review
- (1) Points
- A join condition containing something other than an equality operator (*)
- A join condition that is not equal to other joins.
- A join condition that includes the (+) on the left hand side.
- A join that joins a table to itself
- Correct
- 47. Which keyword in a SELECT statement creates an equijoin by specifying a column name common to both tables? Mark for Review
- (1) Points
- A HAVING clause
- The FROM clause
- The SELECT clause
- A USING clause (*)
- Correct
- 48. Evaluate this SELECT statement:
- SELECT a.lname || ', ' || a.fname as "Patient", b.lname || ', ' || b.fname as "Physician", c.admission
- FROM patient a
- JOIN physician b
- ON (b.physician_id = c.physician_id)
- JOIN admission c
- ON (a.patient_id = c.patient_id);
- Which clause generates an error?
- Mark for Review
- (1) Points
- JOIN physician b
- ON (b.physician_id = c.physician_id); (*)
- JOIN admission c
- ON (a.patient_id = c.patient_id)
- Incorrect. Refer to Section 3 Lesson 2.
- 49. For which condition would you use an equijoin query with the USING keyword? Mark for Review
- (1) Points
- You need to perform a join of the CUSTOMER and ORDER tables but limit the number of columns in the join condition. (*)
- The ORDER table contains a column that has a referential constraint to a column in the PRODUCT table.
- The CUSTOMER and ORDER tables have no columns with identical names.
- 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.
- Correct
- 50. You created the CUSTOMERS and ORDERS tables by issuing these CREATE TABLE statements in sequence:
- CREATE TABLE customers
- (custid varchar2(5),
- companyname varchar2(30),
- contactname varchar2(30),
- address varchar2(30),
- city varchar2(20),
- state varchar2(30),
- phone varchar2(20),
- constraint pk_customers_01 primary key (custid));
- CREATE TABLE orders
- (orderid varchar2(5) constraint pk_orders_01 primary key,
- orderdate date,
- total number(15),
- custid varchar2(5) references customers (custid));
- 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?
- Mark for Review
- (1) Points
- SELECT custid, companyname
- FROM customers
- WHERE city = 'Nashville';
- SELECT orderid, orderdate, total
- FROM orders o
- NATURAL JOIN customers c ON o.custid = c.custid
- WHERE city = 'Nashville';
- SELECT orderid, orderdate, total
- FROM orders o
- JOIN customers c ON o.custid = c.custid
- WHERE city = 'Nashville';
- (*)
- SELECT orderid, orderdate, total
- FROM orders
- WHERE city = 'Nashville';
- Incorrect. Refer to Section 3 Lesson 2.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement