My Quiz 1

54 Questions | Attempts: 137
Share

SettingsSettingsSettings
Database Quizzes & Trivia

Questions and Answers
  • 1. 

    You need to load information about new customers from the NEW_CUST table into the tables   CUST and CUST_SPECIAL. If a new customer has a credit limit greater than 10,000, then the   details have to be inserted into CUST_SPECIAL. All new customer details have to be inserted   into the CUST table. Which technique should be used to load the data most efficiently? You need to load information about new customers from the NEW_CUST table into the tables   CUST and CUST_SPECIAL. If a new customer has a credit limit greater than 10,000, then the   details have to be inserted into CUST_SPECIAL. All new customer details have to be inserted   into the CUST table. Which technique should be used to load the data most efficiently?  

    • A.

      External table

    • B.

      The MERGE command

    • C.

      The multitable INSERT command

    • D.

      . WITH CHECK INSERT using OPTION

    Correct Answer
    C. The multitable INSERT command
  • 2. 

    Evaluate the CREATE TABLE statement:   CREATE TABLE products   (product_id NUMBER(6) CONSTRAINT prod_id_pk PRIMARY KEY,   product_name VARCHAR2(15));   Which statement is true regarding the PROD_ID_PK constraint?

    • A.

      It would be created only if a unique index is manually created first

    • B.

      It would be created and would use an automatically created unique index

    • C.

      It would be created and would use an automatically created unique index

    • D.

      It would be created and remains in a disabled state because no index is specified in the command

    Correct Answer
    B. It would be created and would use an automatically created unique index
  • 3. 

    Which two statements are true? (Choose two.)  

    • A.

      A. The USER_SYNONYMS view can provide information about private synonyms.

    • B.

      B. The user SYSTEM owns all the base tables and user-accessible views of the data dictionary.

    • C.

      C. All the dynamic performance views prefixed with V$ are accessible to all the database users.

    • D.

      . The USER_OBJECTS view can provide information about the tables and views created by the user only

    • E.

      DICTIONARY is a view that contains the names of all the data dictionary views that the user can access

    Correct Answer(s)
    A. A. The USER_SYNONYMS view can provide information about private synonyms.
    E. DICTIONARY is a view that contains the names of all the data dictionary views that the user can access
  • 4. 

    You want to add a constraint on the CUST_FIRST_NAME column of the CUSTOMERS table so   that the value inserted in the column does not have numbers.   Which SQL statement would you use to accomplish the task?

    • A.

      ALTER TABLE CUSTOMERS ADD CONSTRAINT cust_f_name CHECK(REGEXP_LIKE(cust_first_name,'^A-Z'))NOVALIDATE

    • B.

      . ALTER TABLE CUSTOMERS ADD CONSTRAINT cust_f_name CHECK(REGEXP_LIKE(cust_first_name,'^[0-9]'))NOVALIDATE ;

    • C.

      ALTER TABLE CUSTOMERS ADD CONSTRAINT cust_f_name CHECK(REGEXP_LIKE(cust_first_name,'[[:alpha:]]'))NOVALIDATE

    • D.

      ALTER TABLE CUSTOMERS ADD CONSTRAINT cust_f_name CHECK(REGEXP_LIKE(cust_first_name,'[[:digit:]]'))NOVALIDATE

    Correct Answer
    C. ALTER TABLE CUSTOMERS ADD CONSTRAINT cust_f_name CHECK(REGEXP_LIKE(cust_first_name,'[[:alpha:]]'))NOVALIDATE
  • 5. 

    Which three tasks can be performed using regular expression support in Oracle Database 10g?   (Choose three.)    

    • A.

      It can be used to concatenate two strings.

    • B.

      It can be used to find out the total length of the string

    • C.

      It can be used for string manipulation and searching operations

    • D.

      It can be used to format the output for a column or expression having string data

    • E.

      . It can be used to find and replace operations for a column or expression having string data

    Correct Answer(s)
    C. It can be used for string manipulation and searching operations
    D. It can be used to format the output for a column or expression having string data
    E. . It can be used to find and replace operations for a column or expression having string data
  • 6. 

    View the Exhibit and examine the structure of the EMP table which is not partitioned and not an index-organized table.   Evaluate the following SQL statement:   ALTER TABLE emp   DROP COLUMN first_name;   Which two statements is true regarding the above command? (Choose two.)  

    • A.

      A. The FIRST_NAME column would be dropped provided it does not contain any data.

    • B.

      The FIRST_NAME column would be dropped provided at least one or more columns remain in the table

    • C.

      The FIRST_NAME column can be rolled back provided the SET UNUSED option is added to the above SQL statement

    • D.

      . The FIRST_NAME column can be dropped even if it is part of a composite PRIMARY KEY provided the CASCADE option is used.

    Correct Answer(s)
    B. The FIRST_NAME column would be dropped provided at least one or more columns remain in the table
    D. . The FIRST_NAME column can be dropped even if it is part of a composite PRIMARY KEY provided the CASCADE option is used.
  • 7. 

    OE and SCOTT are the users in the database. The ORDERS table is owned by OE. Evaluate the   statements issued by the DBA in the following sequence:   CREATE ROLE r1;   GRANT SELECT, INSERT ON oe.orders TO r1;   GRANT r1 TO scott;   GRANT SELECT ON oe.orders  TO scott;   REVOKE SELECT ON oe.orders FROM scott;   What would be the outcome after executing the statements

    • A.

      SCOTT would be able to query the OE.ORDERS table

    • B.

      SCOTT would not be able to query the OE.ORDERS table

    • C.

      The REVOKE statement would remove the SELECT privilege from SCOTT as well as from the role R1

    • D.

      The REVOKE statement would give an error because the SELECT privilege has been granted to the role R1

    Correct Answer
    A. SCOTT would be able to query the OE.ORDERS table
  • 8. 

    Evaluate the following SQL statement:   ALTER TABLE hr.emp   SET UNUSED (mgr_id);   Which statement is true regarding the effect of the above SQL statement?  

    • A.

      A. Any synonym existing on the EMP table would have to be re-created

    • B.

      Any constraints defined on the MGR_ID column would be removed by the above command

    • C.

      Any views created on the EMP table that include the MGR_ID column would have to be dropped and re-created

    • D.

      Any index created on the MGR_ID column would continue to exist until the DROP UNUSED COLUMNS command is executed

    Correct Answer
    B. Any constraints defined on the MGR_ID column would be removed by the above command
  • 9. 

    EMPDET is an external table containing the columns EMPNO and ENAME.   Which command would work in relation to the EMPDET table?

    • A.

      UPDATE empdet SET ename = 'Amit' WHERE empno = 1234

    • B.

      DELETE FROM empdet WHERE ename LIKE 'J%';

    • C.

      CREATE VIEW empvu AS SELECT * FROM empdept;

    • D.

      CREATE INDEX empdet_idx ON empdet(empno);

    Correct Answer
    C. CREATE VIEW empvu AS SELECT * FROM empdept;
  • 10. 

    In which scenario would you use the ROLLUP operator for expression or columns within a   GROUP BY clause?  

    • A.

      To find the groups forming the subtotal in a row

    • B.

      To create group-wise grand totals for the groups specified within a GROUP BY clause

    • C.

      To create a grouping for expressions or columns specified within a GROUP BY clause in one direction, from right to left for calculating the subtotals

    • D.

      To create a grouping for expressions or columns specified within a GROUP BY clause in all possible directions, which is cross-tabular report for calculating the subtotals

    Correct Answer
    C. To create a grouping for expressions or columns specified within a GROUP BY clause in one direction, from right to left for calculating the subtotals
  • 11. 

    Which three statements indicate the end of a transaction? (Choose three.)  

    • A.

      After a COMMIT is issued

    • B.

      . after a ROLLBACK is issued

    • C.

      .after a SAVEPOINT is issued

    • D.

      After a SELECT statement is issued

    • E.

      After a CREATE statement is issued

    Correct Answer(s)
    A. After a COMMIT is issued
    B. . after a ROLLBACK is issued
    E. After a CREATE statement is issued
  • 12. 

    You need to create a table with the following column specifications:   1. Employee ID (numeric data type) for each employee   2. Employee Name, (character data type) which stores the employee name   3. Hire date, to store the date when the employee joined the organization   4. Status (character data type). It should contain the value if no data is entered.   5. Resume (character large object [CLOB] data type), which would contain the resume submitted   by the employee   Which is the correct syntax to create this table?

    • A.

      CREATE TABLE EMP_1 (emp_id NUMBER(4), emp_name VARCHAR2(25), start_date DATE, e_status VARCHAR2(10) DEFAULT 'ACTIVE', resume CLOB(200));

    • B.

      CREATE TABLE 1_EMP (emp_id NUMBER(4), emp_name VARCHAR2(25), start_date DATE, emp_status VARCHAR2(10) DEFAULT 'ACTIVE', resume CLOB);

    • C.

      CREATE TABLE 1_EMP (emp_id NUMBER(4), emp_name VARCHAR2(25), start_date DATE, emp_status VARCHAR2(10) DEFAULT "ACTIVE", resume CLOB);

    • D.

      CREATE TABLE EMP_1 (emp_id NUMBER, emp_name VARCHAR2(25), start_date DATE, emp_status VARCHAR2(10) DEFAULT 'ACTIVE', resume CLOB);

    Correct Answer
    D. CREATE TABLE EMP_1 (emp_id NUMBER, emp_name VARCHAR2(25), start_date DATE, emp_status VARCHAR2(10) DEFAULT 'ACTIVE', resume CLOB);
  • 13. 

    The details of the order ID, order date, order total, and customer ID are obtained from the   ORDERS table. If the order value is more than 30000, the details have to be added to the   LARGE_ORDERS table. The order ID, order date, and order total should be added to the   ORDER_HISTORY table, and order ID and customer ID should be added to the   CUST_HISTORY table. Which multitable INSERT statement would you use?

    • A.

      A. Pivoting INSERT

    • B.

      B. Unconditional INSERT

    • C.

      C. Conditional ALL INSERT

    • D.

      Conditional FIRST INSERT Answer: C Question: 86 View the Exhibit and examine the description of the EMPLOYEES table. Evaluate the following SQL statement: SELECT first_name, employee_id, NEXT_DAY(ADD_MONTHS(hire_date, 6), 1) "Review" FROM employees; The query was written to retrieve the FIRST_NAME, EMPLOYEE_ID, and review date for employees. The review date is the first Monday after the completion of six months of the hiring. The NLS_TERRITORY parameter is set to AMERICA in the session. Which statement is true regarding this query? A. The query would execute to give the desired output. B. The query would not execute because date functions cannot be nested. C. The query would execute but the output would give review dates that are Sundays. D. The query would not execute because the NEXT_DAY function accepts a string as argument. Answer: C Question: 87 View the Exhibit and examine the structure of the EMPLOYEES table. Page 47 of 91 D. Conditional FIRST INSERT

    Correct Answer
    C. C. Conditional ALL INSERT
  • 14. 

    Evaluate the SQL statements:   CREATE TABLE new_order   (orderno NUMBER(4),   booking_date TIMESTAMP WITH LOCAL TIME ZONE);   The database is located in San Francisco where the time zone is -8:00.   The user is located in New York where the time zone is -5:00.   A New York user inserts the following record:   INSERT INTO new_order   VALUES(1, TIMESTAMP ?007-05-10 6:00:00 -5:00?);   Which statement is true?

    • A.

      When the New York user selects the row, booking_date is displayed as '007-05-10 3.00.00.000000'

    • B.

      When the New York user selects the row, booking_date is displayed as '2007-05-10 6.00.00.000000 -5:00'

    • C.

      When the San Francisco user selects the row, booking_date is displayed as '007-05-10 3.00.00.000000'

    • D.

      When the San Francisco user selects the row, booking_date is displayed as '007-05-10 3.00.00.000000 -8:00'

    Correct Answer
    C. When the San Francisco user selects the row, booking_date is displayed as '007-05-10 3.00.00.000000'
  • 15. 

    Which statements are true? (Choose all that apply.)  

    • A.

      The data dictionary is created and maintained by the database administrator

    • B.

      The data dictionary views can consist of joins of dictionary base tables and user-defined tables

    • C.

      The usernames of all the users including the database administrators are stored in the data dictionary

    • D.

      The USER_CONS_COLUMNS view should be queried to find the names of the columns to which a constraint applies

    • E.

      Both USER_OBJECTS and CAT views provide the same information about all the objects that are owned by the user

    • F.

      Views with the same name but different prefixes, such as DBA, ALL and USER, use the same base tables from the data dictionary

    Correct Answer(s)
    C. The usernames of all the users including the database administrators are stored in the data dictionary
    D. The USER_CONS_COLUMNS view should be queried to find the names of the columns to which a constraint applies
    F. Views with the same name but different prefixes, such as DBA, ALL and USER, use the same base tables from the data dictionary
  • 16. 

    View the Exhibit and examine the data in ORDERS and ORDER_ITEMS tables.   You need to create a view that displays the ORDER ID, ORDER_DATE, and the total number of   items in each order.   Which CREATE VIEW statement would create the view successfully?  

    • A.

      CREATE OR REPLACE VIEW ord_vu (order_id,order_date) AS SELECT o.order_id, o.order_date, COUNT(i.line_item_id) "NO OF ITEMS" FROM orders o JOIN order_items i ON (o.order_id = i.order_id) GROUP BY o.order_id,o.order_date

    • B.

      CREATE OR REPLACE VIEW ord_vu AS SELECT o.order_id, o.order_date, COUNT(i.line_item_id) "NO OF ITEMS" FROM orders o JOIN order_items i ON (o.order_id = i.order_id) GROUP BY o.order_id,o.order_date

    • C.

      CREATE OR REPLACE VIEW ord_vu AS SELECT o.order_id, o.order_date, COUNT(i.line_item_id) FROM orders o JOIN order_items i ON (o.order_id = i.order_id) GROUP BY o.order_id,o.order_date;

    • D.

      CREATE OR REPLACE VIEW ord_vu AS SELECT o.order_id, o.order_date, COUNT(i.line_item_id)||' NO OF ITEMS' FROM orders o JOIN order_items i ON (o.order_id = i.order_id) GROUP BY o.order_id,o.order_date WITH CHECK OPTION;

    Correct Answer
    B. CREATE OR REPLACE VIEW ord_vu AS SELECT o.order_id, o.order_date, COUNT(i.line_item_id) "NO OF ITEMS" FROM orders o JOIN order_items i ON (o.order_id = i.order_id) GROUP BY o.order_id,o.order_date
  • 17. 

    Given below is a list of functions and their purpose in random order.   Function Purpose   1)NVL a) Used for evaluating NOT NULL and NULL values   2)NULLIF b) Used to return the first non- null values in a list of expressions   3)COALESCE c) Used to compare two expressions. If both are same, it returns NULL; otherwise,   it returns only the first expression.   4)NVL2 d) Used to convert NULL values to actual values Identify the correct combination of   functions and their usage

    • A.

      A. 1-a, 2-c, 3-b, 4-d

    • B.

      1-d, 2-c, 3-b, 4-a

    • C.

      1-b, 2-c, 3-d, 4-a

    • D.

      1-d, 2-b, 3-c, 4-a

    Correct Answer
    B. 1-d, 2-c, 3-b, 4-a
  • 18. 

    Which two statements are true regarding subqueries? (Choose two.)  

    • A.

      The ORDER BY clause can be used in the subquery

    • B.

      A subquery can be used in the FROM clause of a SELECT statement

    • C.

      If the subquery returns NULL, the main query may still return result rows

    • D.

      A subquery can be placed in a WHERE clause, GROUP BY clause, or a HAVING clause

    • E.

      . Logical operators, such as AND, OR and NOT, cannot be used in the WHERE clause of a subquery

    Correct Answer(s)
    A. The ORDER BY clause can be used in the subquery
    B. A subquery can be used in the FROM clause of a SELECT statement
  • 19. 

    Which two statements are true regarding the types of table joins available in Oracle Database 10g? (Choose two.)

    • A.

      A. You can use the JOIN clause to join only two tables.

    • B.

      B. You can explicitly provide the join condition with a NATURAL JOIN.

    • C.

      You can use the USING clause to join tables on more than one column.

    • D.

      You can use the ON clause to specify multiple conditions while joining tables.

    Correct Answer(s)
    C. You can use the USING clause to join tables on more than one column.
    D. You can use the ON clause to specify multiple conditions while joining tables.
  • 20. 

    View the Exhibit and examine the description of the ORDERS table. The orders in the ORDERS table are placed through sales representatives only. You are given   the task to get the SALES_REP_ID from the ORDERS table of those sales representatives who   have successfully referred more than 10 customers. Which statement would achieve this   purpose

    • A.

      SELECT sales_rep_id, COUNT(customer_id) "Total" FROM orders HAVING COUNT(customer_id) > 10;

    • B.

      SELECT sales_rep_id, COUNT(customer_id) "Total" FROM orders WHERE COUNT(customer_id) > 10 GROUP BY sales_rep_id;

    • C.

      SELECT sales_rep_id, COUNT(customer_id) "Total" FROM orders GROUP BY sales_rep_id HAVING total > 10;

    • D.

      SELECT sales_rep_id, COUNT(customer_id) "Total" FROM orders GROUP BY sales_rep_id HAVING COUNT(customer_id) > 10;

    Correct Answer
    D. SELECT sales_rep_id, COUNT(customer_id) "Total" FROM orders GROUP BY sales_rep_id HAVING COUNT(customer_id) > 10;
  • 21. 

    View the Exhibit and examine the structure of the PRODUCT_INFORMATION and   INVENTORIES tables. You want to display the quantity on hand for all the products available in the   PRODUCT_INFORMATION table that have the PRODUCT_STATUS as 'orderable'.   QUANTITY_ON_HAND is a column in the INVENTORIES table. The following SQL statement   was written to accomplish the task:   SELECT pi.product_id, pi.product_status, sum(i.quantity_on_hand)   FROM product_information pi LEFT OUTER JOIN inventories i   ON (pi.product_id = i.product_id)   WHERE (pi.product_status = 'orderable')   GROUP BY pi.product_id, pi.product_status;   Which statement is true regarding the execution of this SQL statement?  

    • A.

      The statement would execute and produce the desired output.

    • B.

      The statement would not execute because the WHERE clause is used before the GROUP BY clause.

    • C.

      The statement would not execute because prefixing table alias to column names is not allowed with the ON clause

    • D.

      The statement would not execute because the WHERE clause is not allowed with LEFT OUTER JOIN

    Correct Answer
    A. The statement would execute and produce the desired output.
  • 22. 

    View the Exhibit and examine the structure of the PRODUCT_INFORMATION and   INVENTORIES tables. You want to display the quantity on hand for all the products available in the   PRODUCT_INFORMATION table that have the PRODUCT_STATUS as 'orderable'.   QUANTITY_ON_HAND is a column in the INVENTORIES table. The following SQL statement   was written to accomplish the task:   SELECT pi.product_id, pi.product_status, sum(i.quantity_on_hand)   FROM product_information pi LEFT OUTER JOIN inventories i   ON (pi.product_id = i.product_id)   WHERE (pi.product_status = 'orderable')   GROUP BY pi.product_id, pi.product_status;   Which statement is true regarding the execution of this SQL statement?

    • A.

      The statement would execute and produce the desired output

    • B.

      The statement would not execute because the WHERE clause is used before the GROUP BY clause

    • C.

      The statement would not execute because prefixing table alias to column names is not allowed with the ON clause

    • D.

      The statement would not execute because the WHERE clause is not allowed with LEFT OUTER JOIN

    Correct Answer
    A. The statement would execute and produce the desired output
  • 23. 

    You want to calculate the total remuneration for each employee. Total remuneration is the sum of   the annual salary and the percentage commission earned for a year. Only a few employees earn   commission.   Which SQL statement would you execute to get the desired output

    • A.

      SELECT first_name, salary, salary*12+salary*commission_pct "Total" FROM EMPLOYEES

    • B.

      SELECT first_name, salary, salary*12+NVL((salary*commission_pct), 0) "Total" FROM EMPLOYEES

    • C.

      SELECT first_name, salary, salary*12 + NVL(salary, 0)*commission_pct "Total" FROM EMPLOYEES

    • D.

      SELECT first_name, salary, salary*12+(salary*NVL2(commission_pct, salary,salary+commission_pct))"Total" FROM EMPLOYEES

    Correct Answer
    B. SELECT first_name, salary, salary*12+NVL((salary*commission_pct), 0) "Total" FROM EMPLOYEES
  • 24. 

    There are some products listed in the PRODUCT_INFORMATION table that have no value in the   LIST_PRICE column. You issued the following SQL statement to find out the PRODUCT_NAME   for these products:   SELECT product_name, list_price   FROM product_information   WHERE list_price = NULL;   The query returns no rows. What changes would you make in the statement to get the desired   result?

    • A.

      Change the WHERE clause to WHERE list_price = 0

    • B.

      Change the WHERE clause to WHERE list_price = ' '

    • C.

      Change the WHERE clause to WHERE list_price IS NULL

    • D.

      In the WHERE clause, enclose NULL within single quotation marks

    Correct Answer
    C. Change the WHERE clause to WHERE list_price IS NULL
  • 25. 

    Which two queries would work? (Choose two.)  

    • A.

      SELECT product_name FROM product_information WHERE list_price = (SELECT AVG(list_price) FROM product_information

    • B.

      SELECT product_status FROM product_information GROUP BY product_status WHERE list_price < (SELECT AVG(list_price) FROM product_information

    • C.

      SELECT product_status FROM product_information GROUP BY product_status HAVING list_price > (SELECT AVG(list_price

    • D.

      SELECT product_name FROM product_information WHERE list_price < ANY(SELECT AVG(list_price) FROM product_information GROUP BY product_status);

    Correct Answer(s)
    A. SELECT product_name FROM product_information WHERE list_price = (SELECT AVG(list_price) FROM product_information
    D. SELECT product_name FROM product_information WHERE list_price < ANY(SELECT AVG(list_price) FROM product_information GROUP BY product_status);
  • 26. 

    A subquery is called a single-row subquery when ____.  

    • A.

      The inner query returns a single value to the main query

    • B.

      The inner query uses an aggregate function and returns one or more values

    • C.

      There is only one inner query in the main query and the inner query returns one or more values

    • D.

      The inner query returns one or more values and the main query returns a single value as output

    Correct Answer
    A. The inner query returns a single value to the main query
  • 27. 

    View the Exhibit and examine the structure of ORDER_ITEMS and ORDERS tables, You need to remove from the ORDER_ITEMS table those rows that have an order status of 0 or   1 in the ORDERS table.   Which DELETE statements are valid? (Choose all that apply

    • A.

      DELETE FROM order_items WHERE order_id IN (SELECT order_id FROM orders WHERE order_status in (0,1));

    • B.

      DELETE * FROM order_items WHERE order_id IN (SELECT order_id FROM orders WHERE order_status IN (0,1));

    • C.

      DELETE FROM order_items i WHERE order_id = (SELECT order_id FROM orders o WHERE i.order_id = o.order_id AND order_status IN (0,1));

    • D.

      DELETE FROM (SELECT * FROM order_items i,orders o WHERE i.order_id = o.order_id AND order_status IN (0,1));

    Correct Answer(s)
    A. DELETE FROM order_items WHERE order_id IN (SELECT order_id FROM orders WHERE order_status in (0,1));
    C. DELETE FROM order_items i WHERE order_id = (SELECT order_id FROM orders o WHERE i.order_id = o.order_id AND order_status IN (0,1));
    D. DELETE FROM (SELECT * FROM order_items i,orders o WHERE i.order_id = o.order_id AND order_status IN (0,1));
  • 28. 

    Evaluate the following CREATE TABLE commands:   CREATE TABLE orders   (ord_no NUMBER(2) CONSTRAINT ord_pk PRIMARY KEY,   ord_date DATE,   cust_id NUMBER(4));   CREATE TABLE ord_items   (ord_no NUMBER(2),   item_no NUMBER(3),   qty NUMBER(3) CHECK (qty BETWEEN 100 AND 200),   expiry_date date CHECK (expiry_date > SYSDATE),   CONSTRAINT it_pk PRIMARY KEY (ord_no,item_no),   CONSTRAINT ord_fk FOREIGN KEY(ord_no) REFERENCES orders(ord_no));   Why would the ORD_ITEMS table not get created?

    • A.

      SYSDATE cannot be used with the CHECK constraint

    • B.

      CHECK constraint cannot be used twice for the same table

    • C.

      The BETWEEN clause cannot be used for the CHECK constraint

    • D.

      . ORD_NO and ITEM_NO cannot be used as a composite primary key because ORD_NO is also the FOREIGN KEY

    Correct Answer
    A. SYSDATE cannot be used with the CHECK constraint
  • 29. 

    View the Exhibit and examine the description of the EMPLOYEES table.   You executed the following SQL statement:   SELECT first_name, department_id, salary   FROM employees   ORDER BY department_id, first_name, salary desc;   Which two statements are true regarding the output of the above query? (Choose two.)  

    • A.

      The values in all the columns would be sorted in the descending order

    • B.

      The values in the SALARY column would be sorted in descending order for all the employees having the same value in the DEPARTMENT_ID column

    • C.

      The values in the FIRST_NAME column would be sorted in ascending order for all the employees having the same value in the DEPARTMENT_ID column

    • D.

      The values in the FIRST_NAME column would be sorted in the descending order for all the employees having the same value in the DEPARTMENT_ID column

    • E.

      The values in the SALARY column would be sorted in descending order for all the employees having the same value in the DEPARTMENT_ID and FIRST_NAME column

    Correct Answer(s)
    C. The values in the FIRST_NAME column would be sorted in ascending order for all the employees having the same value in the DEPARTMENT_ID column
    E. The values in the SALARY column would be sorted in descending order for all the employees having the same value in the DEPARTMENT_ID and FIRST_NAME column
  • 30. 

    Evaluate the following query:   SELECT INTERVAL '300' MONTH,   INTERVAL '54-2' YEAR TO MONTH,   INTERVAL '11:12:10.1234567' HOUR TO SECOND   FROM dual; What is the correct output of the above query?

    • A.

      A. +25-00 , +54-02, +00 11:12:10.123457

    • B.

      B. +00-300, +54-02, +00 11:12:10.123457

    • C.

      C. +25-00 , +00-650, +00 11:12:10.123457

    • D.

      D. +00-300 , +00-650, +00 11:12:10.123457

    Correct Answer
    A. A. +25-00 , +54-02, +00 11:12:10.123457
  • 31. 

    You have a requirement from the supplies department to give a list containing PRODUCT_ID,   SUPPLIER_ID, and QUANTITY_ON_HAND for all the products wherein QUANTITY_ON_HAND   is less than five.   Which two SQL statements can accomplish the task? (Choose two.)  

    • A.

      SELECT product_id, quantity_on_hand , supplier_id FROM product_information NATURAL JOIN inventories AND quantity_on_hand < 5;

    • B.

      SELECT i.product_id, i.quantity_on_hand , pi.supplier_id FROM product_information pi JOIN inventories i USING (product_id) AND quantity_on_hand < 5;

    • C.

      SELECT i.product_id, i.quantity_on_hand , pi.supplier_id FROM product_information pi JOIN inventories i ON (pi.product_id=i.product_id)WHERE quantity_on_hand < 5

    • D.

      SELECT i.product_id, i.quantity_on_hand , pi.supplier_id FROM product_information pi JOIN inventories i ON (pi.product_id=i.product_id) AND quantity_on_hand < 5;

    Correct Answer(s)
    C. SELECT i.product_id, i.quantity_on_hand , pi.supplier_id FROM product_information pi JOIN inventories i ON (pi.product_id=i.product_id)WHERE quantity_on_hand < 5
    D. SELECT i.product_id, i.quantity_on_hand , pi.supplier_id FROM product_information pi JOIN inventories i ON (pi.product_id=i.product_id) AND quantity_on_hand < 5;
  • 32. 

    In the ORDERS table, ORDER_ID is the PRIMARY KEY and in the ORDER_ITEMS table,   ORDER_ID and LINE_ITEM_ID form the composite primary key.   Which view can have all the DML operations performed on it?  

    • A.

      CREATE VIEW V1 AS SELECT order_id, product_id FROM order_items;

    • B.

      CREATE VIEW V4(or_no, or_date, cust_id) AS SELECT order_id, order_date, customer_id FROM orders WHERE order_date < '30-mar-2007' WITH CHECK OPTION;

    • C.

      CREATE VIEW V3 AS SELECT o.order_id, o.customer_id, i.product_id FROM orders o, order_items i WHERE o.order_id=i.order_id;

    • D.

      CREATE VIEW V2 AS SELECT order_id, line_item_id, unit_price*quantity total FROM order_items

    Correct Answer
    B. CREATE VIEW V4(or_no, or_date, cust_id) AS SELECT order_id, order_date, customer_id FROM orders WHERE order_date < '30-mar-2007' WITH CHECK OPTION;
  • 33. 

    Which SQL statement would display the view names and definitions of all the views owned by   you?    

    • A.

      SELECT view_name, text FROM user_view

    • B.

      SELECT view_name, text FROM user_object

    • C.

      SELECT view_name, text FROM user_objects

    • D.

      SELECT view_name, text FROM user_views

    Correct Answer
    D. SELECT view_name, text FROM user_views
  • 34. 

    Evaluate the following SQL statements:   Statement 1:   SELECT employee_id, last_name, job_id,   manager_id FROM employees   START WITH employee_id = 101   CONNECT BY PRIOR employee_id = manager_id AND manager_id != 108 ;   Statement 2:   SELECT employee_id, last_name, job_id, manager_id   FROM employees   WHERE manager_id != 108   START WITH employee_id = 101   CONNECT BY PRIOR employee_id = manager_id;   Which two statements are true regarding the above SQL statements? (Choose two

    • A.

      Statement 2 would not execute because the WHERE clause condition is not allowed in a statement that has the START WITH clause

    • B.

      The output for statement 1 would display the employee with MANAGER_ID 108 and all the employees below him or her in the hierarchy

    • C.

      The output of statement 1 would neither display the employee with MANAGER_ID 108 nor any employee below him or her in the hierarchy

    • D.

      The output for statement 2 would not display the employee with MANAGER_ID 108 but it would display all the employees below him or her in the hierarchy

    Correct Answer(s)
    C. The output of statement 1 would neither display the employee with MANAGER_ID 108 nor any employee below him or her in the hierarchy
    D. The output for statement 2 would not display the employee with MANAGER_ID 108 but it would display all the employees below him or her in the hierarchy
  • 35. 

    ORD is a private synonym for the OE.ORDERS table.   The user OE issues the following command:   DROP SYNONYM ord;   Which statement is true regarding the above SQL statement?  

    • A.

      Only the synonym would be dropped

    • B.

      The synonym would be dropped and the corresponding table would become invalid

    • C.

      The synonym would be dropped and the packages referring to the synonym would be dropped

    • D.

      The synonym would be dropped and any PUBLIC synonym with the same name becomes invalid

    Correct Answer
    A. Only the synonym would be dropped
  • 36. 

    Evaluate the following SQL statements that are executed in a user session in the specified order:   CREATE SEQUENCE ord_seq;   SELECT ord_seq.nextval   FROM dual INSERT INTO ord   VALUES (ord_seq.CURRVAL, '25-jan-2007',101);   UPDATE ord   SET ord_no= ord_seq.NEXTVAL   WHERE cust_id =101;   What would be the outcome of the above statements

    • A.

      All the statements would execute successfully and the ORD_NO column would contain the value 2 for the CUST_ID 101

    • B.

      The CREATE SEQUENCE command would not execute because the minimum value and maximum value for the sequence have not been specified

    • C.

      The CREATE SEQUENCE command would not execute because the starting value of the sequence and the increment value have not been specified

    • D.

      All the statements would execute successfully and the ORD_NO column would have the value 20 for the CUST_ID 101 because the default CACHE value is 20

    Correct Answer
    A. All the statements would execute successfully and the ORD_NO column would contain the value 2 for the CUST_ID 101
  • 37. 

    View the Exhibit and examine the data in the PRODUCTS table,statement would add a column called PRICE, which cannot contain NULL

    • A.

      ALTER TABLE products ADD price NUMBER(8,2) NOT NULL

    • B.

      ALTER TABLE products ADD price NUMBER(8,2) DEFAULT NOT NULL

    • C.

      ALTER TABLE products ADD price NUMBER(8,2) DEFAULT 0 NOT NULL

    • D.

      ALTER TABLE products ADD price NUMBER(8,2) DEFAULT CONSTRAINT p_nn NOT NULL

    Correct Answer
    C. ALTER TABLE products ADD price NUMBER(8,2) DEFAULT 0 NOT NULL
  • 38. 

    In the EMPLOYEES table EMPLOYEE_ID is the PRIMARY KEY and DEPARTMENT_ID is the   FOREIGN KEY. In the DEPARTMENTS table DEPARTMENT_ID is the PRIMARY KEY.   Evaluate the following UPDATE statement:   UPDATE employees a   SET department_id =   (SELECT department_id   FROM departments   WHERE location_id = '2100'),   (salary, commission_pct) =   (SELECT 1.1*AVG(salary), 1.5*AVG(commission_pct)   FROM employees b   WHERE a.department_id = b.department_id)   WHERE first_name||' '||last_name = 'Amit Banda';   What would be the outcome of the above statement?

    • A.

      It would execute successfully and update the relevant data

    • B.

      . It would not execute successfully because there is no LOCATION_ID 2100 in the DEPARTMENTS table

    • C.

      It would not execute successfully because the condition specified with the concatenation operator is not valid

    • D.

      It would not execute successfully because multiple columns (SALARY,COMMISSION_PCT)cannot be used in an UPDATE statement

    Correct Answer
    A. It would execute successfully and update the relevant data
  • 39. 

    Evaluate the following SQL statement:   SELECT product_name || 'it's not available for order'   FROM product_information   WHERE product_status = 'obsolete';   You received the following error while executing the above query:   ERROR:   ORA-01756: quoted string not properly terminated   What would you do to execute the query successfully

    • A.

      Enclose the character literal string in the SELECT clause within the double quotation marks

    • B.

      Do not enclose the character literal string in the SELECT clause within the single quotation marks

    • C.

      Use Quote (q) operator and delimiter to allow the use of single quotation mark in the literal character string

    • D.

      Use escape character to negate the single quotation mark inside the literal character string in the SELECT clause

    Correct Answer
    C. Use Quote (q) operator and delimiter to allow the use of single quotation mark in the literal character string
  • 40. 

    Which INSERT statement should be used to add a row into the ORDERS table for the customer   whose CUST_LAST_NAME is Roberts and CREDIT_LIMIT is 600

    • A.

      INSERT INTO orders VALUES (1,'10-mar-2007', 'direct', (SELECT customer_id FROM customers WHERE cust_last_name='Roberts' AND credit_limit=600), 1000);

    • B.

      INSERT INTO orders (order_id,order_date,order_mode, (SELECT customer_id FROM customers WHERE cust_last_name='Roberts' AND credit_limit=600),order_total) VALUES(1,'10-mar-2007', 'direct', &&customer_id, 1000

    • C.

      INSERT INTO orders (order_id,order_date,order_mode, Page 74 of 91 Exam Name: Oracle Database SQL Expert Exam Type Oracle Exam Code: 1Z0-047 Total Questions: 168 (SELECT customer_id FROM customers WHERE cust_last_name='Roberts' AND credit_limit=600),order_total)

    • D.

      INSERT INTO(SELECT o.order_id, o.order_date,o.order_mode,c.customer_id, o.order_total FROM orders o, customers c WHERE o.customer_id = c.customer_id AND c.cust_last_name='Roberts' ANDc.credit_limit=600 ) VALUES (1,'10-mar-2007', 'direct',(SELECT customer_id FROM customers WHERE cust_last_name='Roberts' AND credit_limit=600), 1000)

    Correct Answer
    A. INSERT INTO orders VALUES (1,'10-mar-2007', 'direct', (SELECT customer_id FROM customers WHERE cust_last_name='Roberts' AND credit_limit=600), 1000);
  • 41. 

    Your manager asked you to get the SALES_REP_ID and the total numbers of orders placed by   each of the sales representatives. Which statement would provide the desired result?

    • A.

      SELECT sales_rep_id, COUNT(order_id) total_orders FROM orders GROUP BY sales_rep_id

    • B.

      SELECT sales_rep_id, COUNT(order_id) total_orders FROM orders GROUP BY sales_rep_id, total_orders

    • C.

      SELECT sales_rep_id, COUNT(order_id) total_orders FROM orders

    • D.

      SELECT sales_rep_id, COUNT(order_id) total_orders FROM orders WHERE sales_rep_id IS NOT NULL

    Correct Answer
    A. SELECT sales_rep_id, COUNT(order_id) total_orders FROM orders GROUP BY sales_rep_id
  • 42. 

    Examine the following SQL statement:   SELECT order_id, product_id, unit_price   FROM order_items   WHERE unit_price = (SELECT MAX(unit_price)   FROM order_items   GROUP BY order_id);   You want to display the PRODUCT_ID of the product that has the highest UNIT_PRICE per   ORDER_ID.   What correction should be made in the above SQL statement to achieve this?  

    • A.

      Replace = with the IN operator

    • B.

      Replace = with the >ANY operator

    • C.

      Replace = with the >ALL operator

    • D.

      Remove the GROUP BY clause from the subquery and place it in the main query

    Correct Answer
    A. Replace = with the IN operator
  • 43. 

    You want to display all the cities that have no departments and the departments that have not   been allocated cities.   Which type of join between DEPARTMENTS and LOCATIONS tables would produce this   information as part of its output

    • A.

      NATURAL JOIN

    • B.

      FULL OUTER JOIN

    • C.

      LEFT OUTER JOIN

    • D.

      RIGHT OUTER JOIN

    Correct Answer
    B. FULL OUTER JOIN
  • 44. 

    Evaluate the following statement:   INSERT ALL   WHEN order_total < 10000 THEN   INTO small_orders   WHEN order_total > 10000 AND order_total < 20000 THEN   INTO medium_orders   WHEN order_total > 2000000 THEN   INTO large_orders   SELECT order_id, order_total, customer_id   FROM orders;   Which statement is true regarding the evaluation of rows returned by the subquery in the INSERT   statement?

    • A.

      They are evaluated by all the three WHEN clauses regardless of the results of the evaluation of any other WHEN clause

    • B.

      They are evaluated by the first WHEN clause. If the condition is true, then the row would be evaluated by the subsequent WHEN clauses

    • C.

      They are evaluated by the first WHEN clause. If the condition is false, then the row would be evaluated by the subsequent WHEN clauses

    • D.

      The INSERT statement would give an error because the ELSE clause is not present for support in case none of the WHEN clauses are true

    Correct Answer
    A. They are evaluated by all the three WHEN clauses regardless of the results of the evaluation of any other WHEN clause
  • 45. 

    View the Exhibit and examine the description of the PRODUCT_INFORMATION table.   SELECT product_name, list_price, min_price, list_price - min_price Difference   FROM product_information   Which options when used with the above SQL statement can produce the sorted output in   ascending order of the price difference between LIST_PRICE and MIN_PRICE? (Choose all that   apply.)  

    • A.

      ORDER BY 4

    • B.

      ORDER BY MIN_PRICE

    • C.

      ORDER BY DIFFERENCE

    • D.

      ORDER BY LIST_PRICE

    • E.

      ORDER BY LIST_PRICE - MIN_PRICE

    Correct Answer(s)
    A. ORDER BY 4
    C. ORDER BY DIFFERENCE
    E. ORDER BY LIST_PRICE - MIN_PRICE
  • 46. 

    Which three statements are true? (Choose three.)  

    • A.

      Only one LONG column can be used per table

    • B.

      A TIMESTAMP data type column stores only time values with fractional seconds

    • C.

      BLOB data type column is used to store binary data in an operating system file

    • D.

      The minimum column width that can be specified for a varchar2 data type column is one

    • E.

      The value for a CHAR data type column is blank-padded to the maximum defined column width

    Correct Answer(s)
    A. Only one LONG column can be used per table
    D. The minimum column width that can be specified for a varchar2 data type column is one
    E. The value for a CHAR data type column is blank-padded to the maximum defined column width
  • 47. 

    You want to display ORDER_ID, PRODUCT_ID, and TOTAL (UNIT_PRICE multiplied by   QUANTITY) for all the orders placed in the last seven days.   Which query would you execute?

    • A.

      SELECT order_id, product_id, unit_price*quantity "TOTAL" FROM order_items oi JOIN orders o ON (o.order_id=oi.order_id) WHERE o.order_date>=SYSDATE-7;

    • B.

      SELECT o.order_id,oi.product_id, oi.unit_price*oi.quantity "TOTAL" FROM order_items oi JOIN orders o USING (order_id WHERE o.order_date>=SYSDATE-7;

    • C.

      SELECT o.order_id, oi.product_id, oi.unit_price*oi.quantity "TOTAL" FROM order_items oi JOIN orders o WHERE o.order_date>=SYSDATE-7 ON (o.order_id=oi.order_id);

    • D.

      SELECT o.order_id, oi.product_id, oi.unit_price*oi.quantity "TOTAL" FROM order_items oi JOIN orders o ON (o.order_id=oi.order_id) WHERE o.order_date>=SYSDATE-7;

    Correct Answer
    D. SELECT o.order_id, oi.product_id, oi.unit_price*oi.quantity "TOTAL" FROM order_items oi JOIN orders o ON (o.order_id=oi.order_id) WHERE o.order_date>=SYSDATE-7;
  • 48. 

    Which view would you use to display the column names and DEFAULT values for a table?  

    • A.

      DBA_TABLES

    • B.

      DBA_COLUMNS

    • C.

      USER_COLUMNS

    • D.

      USER_TAB_COLUMNS

    Correct Answer
    D. USER_TAB_COLUMNS
  • 49. 

    Which three statements are true regarding single-row functions? (Choose three.)  

    • A.

      They can accept only one argument

    • B.

      They can be nested up to only two levels

    • C.

      They can return multiple values of more than one data type.

    • D.

      They can be used in SELECT, WHERE, and ORDER BY clauses

    • E.

      They can modify the data type of the argument that is referenced

    • F.

      They can accept a column name, expression, variable name, or a user-supplied constant as arguments

    Correct Answer(s)
    D. They can be used in SELECT, WHERE, and ORDER BY clauses
    E. They can modify the data type of the argument that is referenced
    F. They can accept a column name, expression, variable name, or a user-supplied constant as arguments
  • 50. 

    Which statements are true regarding the usage of the WITH clause in complex correlated   subqueries? (Choose all that apply)

    • A.

      It can be used only with the SELECT clause

    • B.

      The WITH clause can hold more than one query

    • C.

      If the query block name and the table name were the same, then the table name would take precedence

    • D.

      The query name in the WITH clause is visible to other query blocks in the WITH clause as well as to the main query block

    Correct Answer(s)
    A. It can be used only with the SELECT clause
    B. The WITH clause can hold more than one query
    D. The query name in the WITH clause is visible to other query blocks in the WITH clause as well as to the main query block

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Feb 19, 2013
    Quiz Edited by
    ProProfs Editorial Team
  • Jun 20, 2012
    Quiz Created by
    Sreeparna241

Related Topics

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.