IZ0-047

Description

Oracle Certified Associate Oracle - SQL/PLSQL Quiz on IZ0-047, created by RENATO PASQUINI on 30/03/2016.
RENATO PASQUINI
Quiz by RENATO PASQUINI, updated more than 1 year ago
RENATO PASQUINI
Created by RENATO PASQUINI over 8 years ago
340
2

Resource summary

Question 1

Question
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 beused to load the data most efficiently?
Answer
  • external table
  • the MERGE command
  • the multitable INSERT command
  • INSERT using WITH CHECK OPTION

Question 2

Question
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?
Answer
  • ALTER TABLE CUSTOMERS ADD CONSTRAINT cust_f_name CHECK(REGEXP_LIKE(cust_first_name,'^A-Z'))NOVALIDATE ;
  • ALTER TABLE CUSTOMERS ADD CONSTRAINT cust_f_name CHECK(REGEXP_LIKE(cust_first_name,'^[0-9]'))NOVALIDATE ;
  • ALTER TABLE CUSTOMERS ADD CONSTRAINT cust_f_name CHECK(not REGEXP_LIKE(cust_first_name,'[0-9]'))NOVALIDATE ;
  • ALTER TABLE CUSTOMERS ADD CONSTRAINT cust_f_name CHECK(REGEXP_LIKE(cust_first_name,'[[:digit:]]'))NOVALIDATE ;

Question 3

Question
Which three tasks can be performed using regular expression support in Oracle Database 10g? (Choose three.)
Answer
  • It can be used to concatenate two strings.
  • It can be used to find out the total length of the string.
  • It can be used for string manipulation and searching operations.
  • It can be used to format the output for a column or expression having string data.
  • It can be used to find and replace operations for a column or expression having string data.

Question 4

Question
Evaluate the following SQL statement: ALTER TABLE emp DROP COLUMN first_name; Which two statements is true regarding the above command? (Choose two.)
Answer
  • The FIRST_NAME column would be dropped provided it does not contain any data.
  • The FIRST_NAME column would be dropped provided at least one or more columns remain in the table.
  • The FIRST_NAME column can be rolled back provided the SET UNUSED option is added to the above SQL statement.
  • The FIRST_NAME column can be dropped even if it is part of a composite PRIMARY KEY provided the CASCADE option is used.

Question 5

Question
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?
Answer
  • It would be created only if a unique index is manually created first.
  • It would be created and would use an automatically created unique index.
  • It would be created and would use an automatically created no unique index.
  • It would be created and remains in a disabled state because no index is specified in the command.

Question 6

Question
Which two statements are true?
Answer
  • The USER_SYNONYMS view can provide information about private synonyms.
  • The user SYSTEM owns all the base tables and user-accessible views of the data dictionary.
  • All the dynamic performance views prefixed with V$ are accessible to all the database users.
  • The USER_OBJECTS view can provide information about the tables and views created by the user only.
  • DICTIONARY is a view that contains the namesof all the data dictionary views that the user can access.

Question 7

Question
Which two WHERE clause conditions demonstrate the correct usage of conversion functions?
Answer
  • WHERE order_date > TO_DATE('JUL 10 2006','MON DD YYYY')
  • WHERE TO_CHAR(order_date,'MON DD YYYY') = 'JAN 20 2003'
  • WHERE order_date > TO_CHAR(ADD_MONTHS(SYSDATE,6),'MON DD YYYY')
  • WHERE order_date IN ( TO_DATE('Oct 21 2003','Mon DD YYYY'), TO_CHAR('NOV 21 2003','Mon DD YYYY') )

Question 8

Question
View the Exhibit and examine the description of the EMPLOYEES table. Your company decided to give a monthly bonus of $50 to all the employees who have completed five years in the company. The following statement is written to display the LAST_NAME, DEPARTMENT_ID, and the total annual salary: SELECT last_name, department_id, salary+50*12 "Annual Compensation" FROM employees WHERE MONTHS_BETWEEN(SYSDATE, hire_date)/12 >= 5; When you execute the statement, the "Annual Compensation" is not computed correctly. What changes would you make to the query to calculate the annual compensation correctly?
Answer
  • Change the SELECT clause to SELECT last_name, department_id, salary*12+50 "Annual Compensation".
  • Change the SELECT clause to SELECT last_name, department_id, salary+(50*12) "Annual Compensation".
  • Change the SELECT clause to SELECT last_name, department_id, (salary+50)*12 "Annual Compensation".
  • Change the SELECT clause to SELECT last_name, department_id, (salary*12)+50 "Annual Compensation".

Question 9

Question
Evaluate the following CREATE SEQUENCE statement: CREATE SEQUENCE seq1 START WITH 100 INCREMENT BY 10 MAXVALUE 200 CYCLE NOCACHE; The sequence SEQ1 has generated numbers up to the maximum limit of 200. You issue the following SQL statement: SELECT seq1.nextval FROM dual; What is displayed by the SELECT statement?
Answer
  • 1
  • 10
  • 100
  • an error

Question 10

Question
View the Exhibit and examine the description of the EMPLOYEES table. You want to display the EMPLOYEE_ID, FIRST_NAME, and DEPARTMENT_ID for all the employees who work in the same department and have the same manager as that of the employee having EMPLOYEE_ID 104. To accomplish the task, you execute the following SQL statement: SELECT employee_id, first_name, department_id FROM employees WHERE (manager_id, department_id) =(SELECT department_id, manager_id FROM employees WHERE employee_id = 104) AND employee_id <> 104; When you execute the statement itdoes not produce the desired output. What is the reason for this?
Answer
  • The WHERE clause condition in the main query is using the = comparison operator, instead of EXISTS.
  • The WHERE clause condition in the main query is using the = comparison operator, instead of the IN operator.
  • The WHERE clause condition in the main query is using the = comparison operator, instead of the = ANY operator.
  • The columns in the WHERE clause condition ofthe main query and the columns selected in the subquery should be in the same order.

Question 11

Question
View the Exhibit and examine the descriptions of ORDER_ITEMS and ORDERS tables. You want to display the CUSTOMER_ID, PRODUCT_ID, and total (UNIT_PRICE multiplied by QUANTITY) for the order placed. You also want to display the subtotals for a CUSTOMER_ID as well as for a PRODUCT_ID for the last six months. Which SQL statement would you execute to get the desired output?
Answer
  • SELECT o.customer_id, oi.product_id, SUM(oi.unit_price*oi.quantity) "Total" FROM order_items oi JOIN orders o ON oi.order_id=o.order_id GROUP BY ROLLUP (o.customer_id,oi.product_id) WHERE MONTHS_BETWEEN(order_date, SYSDATE) <= 6;
  • SELECT o.customer_id, oi.product_id, SUM(oi.unit_price*oi.quantity) "Total" FROM order_items oi JOIN orders o ON oi.order_id=o.order_id GROUP BY ROLLUP (o.customer_id,oi.product_id) HAVING MONTHS_BETWEEN(order_date, SYSDATE) <= 6;
  • SELECT o.customer_id, oi.product_id, SUM(oi.unit_price*oi.quantity) "Total" FROM order_items oi JOIN orders o ON oi.order_id=o.order_id GROUP BY ROLLUP (o.customer_id, oi.product_id) WHERE MONTHS_BETWEEN(order_date, SYSDATE) >= 6;
  • SELECT o.customer_id, oi.product_id, SUM(oi.unit_price*oi.quantity) "Total" FROM order_items oi JOIN orders o ON oi.order_id=o.order_id WHERE MONTHS_BETWEEN(order_date, SYSDATE) <= 6 GROUP BY ROLLUP (o.customer_id, oi.product_id) ;

Question 12

Question
View the Exhibit and examine the structure of the EMPLOYEES table. You want to retrieve hierarchical data of the employees using the top-down hierarchy. Which SQL clause would let you choose the direction to walk through the hierarchy tree?
Answer
  • WHERE
  • HAVING
  • GROUP BY
  • START WITH
  • CONNECT BY PRIOR

Question 13

Question
Which two statements is true regarding the execution of the correlated subqueries?
Answer
  • The nested query executes after the outer query returns the row.
  • The nested query executes first and then the outer query executes.
  • The outer query executes only once for the result returned by the inner query.
  • Each row returned by the outer query is evaluated for the results returned by the inner query.

Question 14

Question
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?
Answer
  • SCOTT would be able to query the OE.ORDERS table.
  • SCOTT would not be able to query the OE.ORDERS table.
  • The REVOKE statement would remove the SELECT privilege from SCOTT as well as from the role R1.
  • The REVOKE statement would give an error because the SELECT privilege has been granted to the role R1.

Question 15

Question
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?
Answer
  • Any synonym existing on the EMP table would have to be re-created.
  • Any constraints defined on the MGR_ID column would be removed by the above command.
  • Any views created on the EMP table that include the MGR_ID column would have to be dropped and re-created.
  • Any index created on the MGR_ID column would continue to exist until the DROP UNUSED COLUMNS command is executed.

Question 16

Question
EMPDET is an external table containing the columns EMPNO and ENAME. Which command would work in relation to the EMPDET table?
Answer
  • UPDATE empdet SET ename = 'Amit' WHERE empno = 1234;
  • DELETE FROM empdet WHERE ename LIKE 'J%';
  • CREATE VIEW empvu AS SELECT * FROM empdept;
  • CREATE INDEX empdet_idx ON empdet(empno);

Question 17

Question
View the Exhibit and examine the structure of the MARKS_DETAILS and MARKStables. Which is the best method to load data fromthe MARKS_DETAILStable to the MARKStable?
Answer
  • Pivoting INSERT
  • Unconditional INSERT
  • Conditional ALL INSERT
  • Conditional FIRST INSERT

Question 18

Question
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?
Answer
  • 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;
  • 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;
  • 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;
  • 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;

Question 19

Question
View the Exhibit and examine PRODUCTS and ORDER_ITEMS tables. You executed the following query to display PRODUCT_NAME and the number of times the product has been ordered: SELECT p.product_name, i.item_cnt FROM (SELECT product_id, COUNT (*) item_cnt FROM order_items GROUP BY product_id) i RIGHT OUTER JOIN products p ON i.product_id = p.product_id; What would happen when the above statement is executed?
Answer
  • The statement would execute successfully to produce the required output.
  • The statement would not execute because inline views and outer joins cannot be used together.
  • The statement would not execute because the ITEM_CNT alias cannot be displayed in the outer query.
  • The statement would not execute because the GROUP BY clause cannot be used in the inline view.

Question 20

Question
In which scenario would you use the ROLLUP operator for expression or columns within a GROUP BY clause?
Answer
  • to find the groups forming the subtotal in a row
  • to create group-wise grand totals for the groups specified within a GROUP BY clause
  • 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
  • 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

Question 21

Question
View the Exhibit and examine the details of the EMPLOYEES table. Evaluate the following SQL statement: SELECT phone_number, REGEXP_REPLACE(phone_number,'([[:digit:]]{3})\.([[:digit:]]{3})\.([[:digit:]]{4})', '(\1) \2-\3') "PHONE NUMBER" FROM employees; The query was written to format the PHONE_NUMBER for the employees. Which option would be the correct format in the output?
Answer
  • xxx-xxx-xxxx
  • (xxx) xxxxxxx
  • (xxx) xxx-xxxx
  • xxx-(xxx)-xxxx

Question 22

Question
Which statement correctly grants a system privilege?
Answer
  • GRANT EXECUTE ON proc1 TO PUBLIC;
  • GRANT CREATE VIEW ON table1 TO user1;
  • GRANT CREATE TABLE TO user1,user2;
  • GRANT CREATE SESSION TO ALL;

Question 23

Question
View the Exhibit and examine the structure of the CUST table. Evaluate the following SQL statements executed in the given order: ALTER TABLE cust ADD CONSTRAINT cust_id_pk PRIMARY KEY(cust_id) DEFERRABLE INITIALLY DEFERRED; INSERT INTO cust VALUES (1,'RAJ'); --row 1 INSERT INTO cust VALUES (1,'SAM'); --row 2 COMMIT; SET CONSTRAINT cust_id_pk IMMEDIATE; INSERT INTO cust VALUES (1,'LATA'); --row 3 INSERT INTO cust VALUES (2,'KING'); --row 4 COMMIT; Which rows would be made permanent in the CUST table?
Answer
  • row 4 only
  • rows 2 and 4
  • rows 3 and 4
  • rows 1 and 4

Question 24

Question
View the Exhibit and examine the structure of the ORDERS table: The ORDER_ID column has the PRIMARY KEY constraint and CUSTOMER_ID has the NOT NULL constraint. Evaluate the following statement: INSERT INTO (SELECT order_id,order_date,customer_id FROM ORDERS WHERE order_total = 1000 WITH CHECK OPTION) VALUES (13, SYSDATE, 101); What would be the outcome of the above INSERT statement?
Answer
  • It would execute successfully and the new row would be inserted into a new temporary table created by the subquery.
  • It would execute successfully and the ORDER_TOTAL column would have the value 1000 inserted automatically in the new row.
  • It would not execute successfully because the ORDER_TOTAL column is not specified in the SELECT list and no value is provided for it.
  • It would not execute successfully because all the columns from the ORDERS table should have been included in the SELECT list and values should have been provided for all the columns.

Question 25

Question
View the Exhibit and examine the description of the EMPLOYEES table. Your company wants to give 5% bonus to all the employees on their annual salary. The SALARY column stores the monthly salary for an employee. To check the total for annual salary and bonus amount for each employee, you issued the following SQL statement: SELECT first_name, salary, salary*12+salary*12*.05 "ANNUAL SALARY + BONUS" FROM employees; Which statement is true regarding the above query?
Answer
  • It would execute and give you the desired output.
  • It would not execute because the AS keyword is missing between the column name and the alias.
  • It would not execute because double quotation marks are used instead of single quotation marks for assigning alias for the third column.
  • It would execute but the result for the third column would be inaccurate because the parentheses for overriding the precedence of the operator are missing

Question 26

Question
Which statement is true regarding external tables?
Answer
  • The default REJECT LIMIT for external tables is UNLIMITED.
  • The data and metadata for an externaltable are stored outside the database.
  • ORACLE_LOADER and ORACLE_DATAPUMP have exactly the same functionality when used with an external table.
  • The CREATE TABLE AS SELECT statement can be used to unload data into regular table in the database from an external table.

Question 27

Question
View the Exhibit and examine the structure of the PRODUCT_INFORMATION table. You want to see the product names and the date ofexpiration of warranty for all the products, if the product is purchased today. The products thathave no warranty should be displayed at the top and the products with maximum warranty period should be displayed at the bottom. Which SQL statement would you execute to fulfill this requirement?
Answer
  • SELECT product_name, category_id, SYSDATE+warranty_period AS "Warranty expire date" FROM product_information ORDER BY SYSDATE-warranty_period;
  • SELECT product_name, category_id, SYSDATE+warranty_period AS "Warranty expire date" FROM product_information ORDER BY SYSDATE+warranty_period;
  • SELECT product_name, category_id, SYSDATE+warranty_period AS "Warranty expire date" FROM product_information ORDER BY SYSDATE;
  • SELECT product_name, category_id, SYSDATE+warranty_period "Warranty expire date" FROM product_information WHERE warranty_period >SYSDATE;

Question 28

Question
Which two statements are true regarding the EXISTS operator used in the correlated subqueries?
Answer
  • The outer query stops evaluating the result set ofthe inner query when the first value is found.
  • It is used to test whether the values retrieved by the inner query exist in the result of the outer query.
  • It is used to test whether the values retrieved by the outer query exist in the result set of the inner query.
  • The outer query continues evaluating the result set of the inner query until all the values in the result set are processed.

Question 29

Question
A non-correlated subquery can be defined as ____.
Answer
  • a set of sequential queries, all of which must always return a single value
  • a set of sequential queries, all of which must return values from the same table
  • a SELECT statement that can be embedded ina clause of another SELECT statement only
  • a set of one or more sequential queries in which generally the result of the inner query is used as the search value in the outer query

Question 30

Question
You need to create a table for a banking application with the following considerations: 1) You want a column in the table to store the duration of the credit period. 2) The data in the column should be stored in a format such that it can be easily added and subtracted with 3) date type data without using the conversion functions. 4) The maximum period of the credit provision in the application is 30 days. 5) The interest has to be calculated for the number of days an individual has taken a credit for. Which data type would you use for such a column in the table?
Answer
  • INTERVAL YEAR TO MONTH
  • INTERVAL DAY TO SECOND
  • TIMESTAMP WITH TIME ZONE
  • TIMESTAMP WITH LOCAL TIME ZONE

Question 31

Question
Which statements are true regarding the hierarchical query in Oracle Database 10g?
Answer
  • It is possible to retrieve data only in top-down hierarchy.
  • It is possible to retrieve data in top-down or bottom-up hierarchy.
  • It is possible to remove an entire branch from the output of the hierarchical query.
  • You cannot specify conditions when you retrieve data by using a hierarchical query.

Question 32

Question
Which two statements are true regarding views? (Choose two.)
Answer
  • A simple view in which column aliases have been used cannot be updated.
  • A subquery used in a complex view definition cannot contain group functions or joins.
  • Rows cannot be deleted through a view if the view definition contains the DISTINCT keyword.
  • Rows added through a view are deleted from the table automatically when the view is dropped.
  • The OR REPLACE option is used to change the definition of an existing view without dropping and re-creating it.
  • The WITH CHECK OPTION constraint can be used in a view definition to restrict the columns displayed through the view.

Question 33

Question
View the Exhibit and examine the details of the ORDER_ITEMS table. Evaluate the following SQL statements: Statement 1: SELECT MAX(unit_price*quantity) "Maximum Order" FROM order_items; Statement 2: SELECT MAX(unit_price*quantity) "Maximum Order" FROM order_items GROUP BY order_id; Which statements are true regarding the output of these SQL statements? (Choose all that apply.)
Answer
  • Statement 1 would return only one row of output.
  • Both the statements would give the same output.
  • Statement 2 would return multiple rows of output.
  • Statement 1 would not return any row because the GROUP BY clause is missing.
  • Both statements would ignore NULL values for the UNIT_PRICE and QUANTITY columns.

Question 34

Question
View the Exhibit and examine the structure of the ORDERS and ORDER_ITEMS tables. Evaluate the following SQL statement: SELECT oi.order_id, product_id, order_date FROM order_items oi JOIN orders o USING(order_id); Which statement is true regarding the execution of this SQL statement?
Answer
  • The statement would not execute because table aliases are not allowed in the JOIN clause.
  • The statement would not execute because the table alias prefix is not used in the USING clause.
  • The statement would not execute because all the columns in the SELECT clause are not prefixed with table aliases.
  • The statement would not execute because the column part of the USING clause cannot have a qualifier in the SELECT list.

Question 35

Question
Evaluate the following SQL statements in the given order: DROP TABLE dept; CREATE TABLE dept (deptno NUMBER(3) PRIMARY KEY, deptname VARCHAR2(10)); DROP TABLE dept; FLASHBACK TABLE dept TO BEFORE DROP; Which statement is true regarding the above FLASHBACK operation?
Answer
  • It recovers only the first DEPT table.
  • It recovers only the second DEPT table.
  • It does not recover any of the tables because FLASHBACK is not possible in this case.
  • It recovers both the tables but the names would be changed to the ones assigned in the RECYCLEBIN.

Question 36

Question
Evaluate the following statements: CREATE TABLE digits (id NUMBER(2), description VARCHAR2(15)); INSERT INTO digits VALUES (1,'ONE'); UPDATE digits SET description ='TWO' WHERE id=1; INSERT INTO digits VALUES (2,'TWO'); COMMIT; DELETE FROM digits; SELECT description FROM digits VERSIONS BETWEEN TIMESTAMP MINVALUE AND MAXVALUE; What would be the outcome of the above query?
Answer
  • It would not display any values.
  • It would display the value TWO once.
  • It would display the value TWO twice.
  • It would display the values ONE, TWO, and TWO.

Question 37

Question
View the Exhibit and examine the description of the ORDERS table. Evaluate the following SQL statement: SELECT order_id, customer_id FROM orders WHERE order_date > 'June 30 2001'; Which statement is true regarding the execution of this SQL statement?
Answer
  • It would not execute because 'June 30 2001' in the WHERE condition is not enclosed within double quotation marks.
  • It would execute and would return ORDER_ID and CUSTOMER_ID for all records having ORDER_DATE greater than 'June 30 2001'.
  • It would not execute because 'June 30 2001' in the WHERE condition cannot be converted implicitly and needs the use of the TO_DATE conversion function for proper execution.
  • It would not execute because 'June 30 2001' in the WHERE condition cannot be converted implicitly and needs the use of the TO_CHAR conversion function for proper execution.

Question 38

Question
Which statements are correct regarding indexes? (Choose all that apply.)
Answer
  • When a table is dropped, the corresponding indexes are automatically dropped.
  • For each DML operation performed, the corresponding indexes are automatically updated.
  • Indexes should be created on columns that are frequently referenced as part of an expression.
  • A non-deferrable PRIMARY KEY or UNIQUE KEY constraint in a table automatically creates a unique index.

Question 39

Question
View the Exhibit and examine the description of the PRODUCT_INFORMATION table. Which SQL statement would retrieve from the table the number of products having LIST_PRICE as NULL?
Answer
  • SELECT COUNT(list_price) FROM product_information WHERE list_price IS NULL;
  • SELECT COUNT(list_price) FROM product_information WHERE list_price = NULL;
  • SELECT COUNT(NVL(list_price, 0)) FROM product_information WHERE list_price IS NULL;
  • SELECT COUNT(DISTINCT list_price) FROM product_information WHERE list_price IS NULL;

Question 40

Question
User OE, the owner of the ORDERS table, issues the following command: GRANT SELECT ,INSERT ON orders TO hr WITH GRANT OPTION; The user HR issues the following command: GRANT SELECT ON oe.orders TO scott; Then, OE issues the following command: REVOKE ALL ON orders FROM hr; Which statement is correct?
Answer
  • The user SCOTT loses the privilege to select rows from OE.ORDERS.
  • The user SCOTT retains the privilege to select rows from OE.ORDERS.
  • The REVOKE statement generates an error because OE has to first revoke the SELECT privilege from SCOTT.
  • The REVOKE statement generates an error because the ALL keyword cannot be used for privileges that have been granted using WITH GRANT OPTION.

Question 41

Question
View the Exhibit and examine the structure of the EMP table. You executed the following command to add a primary key to the EMP table: ALTER TABLE emp ADD CONSTRAINT emp_id_pk PRIMARY KEY (emp_id) USING INDEX emp_id_idx; Which statement is true regarding the effect of the command?
Answer
  • The PRIMARY KEY is created along with a new index.
  • The PRIMARY KEY is created and it would use an existing unique index.
  • The PRIMARY KEY would be created in a disabled state because it is using an existing index.
  • The statement produces an error because the USING clause is permitted only in the CREATE TABLE command.

Question 42

Question
SCOTT is a user in the database. Evaluate the commands issued by the DBA: 1 - CREATE ROLE mgr; 2 - GRANT CREATE TABLE, SELECT ON oe.orders TO mgr; 3 - GRANT mgr, create table TO SCOTT; Which statement is true regarding the execution of the above commands?
Answer
  • Statement 1 would not execute because the WITH GRANT option is missing.
  • Statement 1 would not execute because the IDENTIFIED BY <password> clause is missing.
  • Statement 3 would not execute because role and system privileges cannot be granted together in a single GRANT statement.
  • Statement 2 would not execute because system privileges and object privileges cannot be granted together in a single GRANT command.

Question 43

Question
Which statement best describes the GROUPING function?
Answer
  • It is used to set the order for the groups to be used for calculating the grand totals and subtotals.
  • It is used to form various groups to calculate total and subtotals created using ROLLUP and CUBE operators.
  • It is used to identify if the NULL value in an expression is a stored NULL value or created by ROLLUP or CUBE.
  • It is used to specify the concatenated group expressions to be used for calculating the grand totals and subtotals.

Question 44

Question
View the Exhibit and examine the structure of ORD and ORD_ITEMS tables. In the ORD table, the PRIMARY KEY is ORD_NO and in the ORD_ITEMS tables the composite PRIMARY KEY is (ORD_NO, ITEM_NO). Which two CREATE INDEX statements are valid? (Choose two.)
Answer
  • CREATE INDEX ord_idx ON ord(ord_no);
  • CREATE INDEX ord_idx ON ord_items(ord_no);
  • CREATE INDEX ord_idx ON ord_items(item_no);
  • CREATE INDEX ord_idx ON ord,ord_items(ord_no, ord_date,qty);

Question 45

Question
View the Exhibit and examine the structure of the CUSTOMERS table. CUSTOMER_VU is a view based on CUSTOMERS_BR1 table which has the same structure as CUSTOMERS table. CUSTOMERS needs to be updated to reflect the latest information about the customers. What is the error in the following MERGE statement? MERGE INTO customers c USING customer_vu cv ON (c.customer_id = cv.customer_id) WHEN MATCHED THEN UPDATE SET c.customer_id = cv.customer_id, c.cust_name = cv.cust_name, c.cust_email = cv.cust_email, c.income_level = cv.income_level WHEN NOT MATCHED THEN INSERT VALUES(cv.customer_id,cv.cust_name,cv.cust_email,cv,income_level) WHERE cv.income_level >100000;
Answer
  • The CUSTOMER_ID column cannot be updated.
  • The INTO clause is misplaced in the command.
  • The WHERE clause cannot be used with INSERT.
  • CUSTOMER_VU cannot be used as a data source.

Question 46

Question
Which two statements are true regarding operators used with subqueries? (Choose two.)
Answer
  • The NOT IN operator is equivalent to IS NULL.
  • The <ANY operator means less than the maximum.
  • =ANY and =ALL operators have the same functionality.
  • The IN operator cannot be used in single-row subqueries.
  • The NOT operator can be used with IN, ANY and ALL operators.

Question 47

Question
Given below are the SQL statements executed in a user session: CREATE TABLE product (pcode NUMBER(2), pname VARCHAR2(10)); INSERT INTO product VALUES(1, 'pen'); INSERT INTO product VALUES (2,'pencil'); SAVEPOINT a; UPDATE product SET pcode = 10 WHERE pcode = 1; SAVEPOINT b; DELETE FROM product WHERE pcode = 2; COMMIT; DELETE FROM product WHERE pcode=10; ROLLBACK TO SAVEPOINT a; Which statement describes the consequences?
Answer
  • No SQL statement would be rolled back.
  • Both the DELETE statements would be rolled back.
  • Only the second DELETE statement would be rolled back.
  • Both the DELETE statements and the UPDATE statement would be rolled back.

Question 48

Question
Evaluate the following CREATE TABLE command: CREATE TABLE order_item (order_id NUMBER(3), item_id NUMBER(2), qty NUMBER(4), CONSTRAINT ord_itm_id_pk PRIMARY KEY (order_id,item_id) USING INDEX (CREATE INDEX ord_itm_idx ON order_item(order_id,item_id))); Which statement is true regarding the above SQL statement?
Answer
  • It would execute successfully and only ORD_ITM_IDX index would be created.
  • It would give an error because the USING INDEX clause cannot be used on a composite primary key.
  • It would execute successfully and two indexes ORD_ITM_IDX and ORD_ITM_ID_PK would be created.
  • It would give an error because the USING INDEX clause is not permitted in the CREATE TABLE command.

Question 49

Question
View the Exhibit and examine the description of EMPLOYEES and DEPARTMENTS tables. You want to display the EMPLOYEE_ID, LAST_NAME, and SALARY for the employees who get the maximum salary in their respective departments. The following SQL statement was written: WITH SELECT employee_id, last_name, salary FROM employees WHERE (department_id, salary) = ANY (SELECT * FROM dept_max) dept_max as ( SELECT d.department_id, max(salary) FROM departments d JOIN employees j ON (d.department_id = j.department_id) GROUP BY d.department_id); Which statement is true regarding the execution and the output of this statement?
Answer
  • The statement would execute and give the desired results.
  • The statement would not execute because the = ANY comparison operator is used instead of =.
  • The statement would not execute because the main query block uses the query name before it is even created.
  • The statement would not execute because the comma is missing between the main query block and the query name.

Question 50

Question
View the Exhibit and examine the data in the DEPARTMENTS tables. SELECT department_id "DEPT_ID", department_name , 'b' FROM departments WHERE department_id=90 UNION SELECT department_id, department_name DEPT_NAME, 'a' FROM departments WHERE department_id=10 Which two ORDER BY clauses can be used to sort the output of the above statement? (Choose two.)
Answer
  • ORDER BY 3;
  • ORDER BY 'b';
  • ORDER BY DEPT_ID;
  • ORDER BY DEPT_NAME;

Question 51

Question
View the Exhibit and examine the description of the EMPLOYEES table. You want to know the EMPLOYEE_ID and FIRST_NAME of all the records in the EMPLOYEES table wherein the JOB_ID column has ST_CLERK or ST_MAN values, the DEPARTMENT_ID column has value 30, and the SALARY column has a value greater than 3,000. Which SQL statement would get you the desired result?
Answer
  • SELECT employee_id, first_name FROM employees WHERE job_id like 'MAN%' OR job_id like 'CLERK%' AND department_id = 30 AND salary > 3000;
  • SELECT employee_id, first_name FROM employees WHERE job_id like '%MAN' OR job_id like '%CLERK' AND (department_id = 30 OR salary > 3000);
  • SELECT employee_id, first_name FROM employees WHERE (job_id like '%MAN' AND job_id like '%CLERK') AND department_id = 30 OR salary > 3000;
  • SELECT employee_id, first_name FROM employees WHERE (job_id like '%MAN' OR job_id like '%CLERK' ) AND department_id = 30 AND salary > 3000;

Question 52

Question
View the Exhibit and examine the structure of the ORDERS table. The ORDERS table belongs to the user OE. HR is another user in the database. Evaluate the commands issued by users OE and HR in the following order: Statement 1 by user OE: GRANT SELECT, UPDATE(customer_id, order_total) ON orders TO hr; Statement 1 by user HR: SELECT * FROM oe.orders; Statement 2 by user HR: UPDATE oe.orders SET order_total= 10000; Which statement is true regarding the above commands?
Answer
  • Statement 1 by user OE would not work because the statement has to be issued by the DBA.
  • Statement 2 by user HR would not work because the grant is only for SELECT in a subquery of update.
  • There are no errors in the statements issued by OE and HR; all the statements would execute successfully.
  • Statement 1 by user HR would not work because SELECT and UPDATE privileges have been granted only on CUSTOMER_ID and ORDER_TOTAL columns.

Question 53

Question
View the Exhibit and examine the structure of the ORDER_ITEMS table. You need to display the ORDER_ID of the order that has the highest total value among all the orders in the ORDER_ITEMS table. Which query would produce the desired output?
Answer
  • SELECT order_id FROM order_items WHERE(unit_price*quantity) = MAX(unit_price*quantity) GROUP BY order_id;
  • SELECT order_id FROM order_items WHERE(unit_price*quantity) = (SELECT MAX(unit_price*quantity) FROM order_items) GROUP BY order_id;
  • SELECT order_id FROM order_items WHERE (unit_price*quantity) = (SELECT MAX(unit_price*quantity) FROM order_items GROUP BY order_id);
  • SELECT order_id FROM order_items GROUP BY order_id HAVING SUM(unit_price*quantity) =(SELECT MAX(SUM(unit_price*quantity)) FROM order_items GROUP BY order_id);

Question 54

Question
Which two statements are true about sequences created in a single instance database? (Choose two.)
Answer
  • The numbers generated by a sequence can be used only for one table.
  • DELETE <sequencename> would remove a sequence from the database.
  • CURRVAL is used to refer to the last sequence number that has been generated.
  • When the MAXVALUE limit for a sequence is reached, you can increase the MAXVALUE limit by using the ALTER SEQUENCE statement.
  • When a database instance shuts down abnormally, the sequence numbers that have been cached but not used would be available once again when the database instance is restarted.

Question 55

Question
View the Exhibit and examine the structure of the EMPLOYEES and DEPARTMENTS tables. Which SET operator would you use in the blank space in the following SQL statement to list the departments where all the employees have managers? SELECT department_id FROM departments ____ SELECT department_id FROM employees WHERE manager_id IS NULL;
Answer
  • UNION
  • MINUS
  • INTERSECT
  • UNION ALL

Question 56

Question
Which mandatory clause has to be added to the following statement to successfully create an external table called EMPDET? CREATE TABLE empdet (empno CHAR(2), ename CHAR(5), deptno NUMBER(4)) ORGANIZATION EXTERNAL (LOCATION ('emp.dat'));
Answer
  • TYPE
  • REJECT LIMIT
  • DEFAULT DIRECTORY
  • ACCESS PARAMETERS

Question 57

Question
View the Exhibit and examine the description of the ORDER_ITEMS and PRODUCT_INFORMATION tables. The ORDER_ITEM table has records pertaining to details for each product in an order. The PRODUCT_INFORMATION table has records for all the products available for ordering. Evaluate the following SQL statement: SELECT oi.order_id, pi.product_id FROM order_items oi RIGHT OUTER JOIN product_information pi ON (oi.product_id=pi.product_id); Which statement is true regarding the output of this SQL statement?
Answer
  • The query would return the ORDER_ID and PRODUCT_ID for only those products that are ordered.
  • The query would return the ORDER_ID and PRODUCT_ID for the products that are ordered as well as for the products that have never been ordered
  • The query would return the ORDER_ID and PRODUCT_ID for the products that are ordered but not listed in the PRODUCT_INFORMATION table.
  • The query would return the ORDER_ID and PRODUCT_ID for those products that are ordered as well as for the products that have never been ordered, and for the products that are not listed in the PRODUCT_INFORMATION table.

Question 58

Question
Evaluate the following statement: CREATE TABLE bonuses(employee_id NUMBER, bonus NUMBER DEFAULT 100); The details of all employees who have made sales need to be inserted into the BONUSES table. You can obtain the list of employees who have made sales based on the SALES_REP_ID column of the ORDERS table. The human resources manager now decides that employees with a salary of $8,000 or less should receive a bonus. Those who have not made sales get a bonus of 1% of their salary. Those who have made sales get a bonus of 1% of their salary and also a salary increase of 1%. The salary of each employee can be obtained from the EMPLOYEES table. Which option should be used to perform this task most efficiently?
Answer
  • MERGE
  • Unconditional INSERT
  • Conditional ALL INSERT
  • Conditional FIRST INSERT

Question 59

Question
Which statement is true regarding the ROLLUP operator specified in the GROUP BY clause of a SQL statement?
Answer
  • It produces only the subtotals for the groups specified in the GROUP BY clause.
  • It produces only the grand totals for the groups specified in the GROUP BY clause.
  • It produces higher-level subtotals, moving from right to left through the list of grouping columns specified in the GROUP BY clause.
  • It produces higher-level subtotals, moving in all the directions through the list of grouping columns specified in the GROUP BY clause.

Question 60

Question
View the Exhibit and examine DEPARTMENTS and the LOCATIONS tables. Evaluate the following SQL statement: SELECT location_id, city FROM locations l WHERE NOT EXISTS (SELECT location_id FROM departments WHERE location_id <> l.location_id); This statement was written to display LOCATION_ID and CITY where there are no departments located. Which statement is true regarding the execution and output of the command?
Answer
  • The statement would execute and would return the desired results.
  • The statement would not execute because the = comparison operator is missing in the WHERE clause of the outer query.
  • The statement would execute but it will return zero rows because the WHERE clause in the inner query should have the = operator instead of <>.
  • The statement would not execute because the WHERE clause in the outer query is missing the column name for comparison with the inner query result.

Question 61

Question
Evaluate the following SQL statements that are issued in the given order: CREATE TABLE emp (emp_no NUMBER(2) CONSTRAINT emp_emp_no_pk PRIMARY KEY, ename VARCHAR2(15), salary NUMBER(8,2), mgr_no NUMBER(2) CONSTRAINT emp_mgr_fk REFERENCES emp); ALTER TABLE emp DISABLE CONSTRAINT emp_emp_no_pk CASCADE; ALTER TABLE emp ENABLE CONSTRAINT emp_emp_no_pk; What would be the status of the foreign key EMP_MGR_FK?
Answer
  • It would be automatically enabled and deferred.
  • It would be automatically enabled and immediate.
  • It would remain disabled and has to be enabled manually using the ALTER TABLE command.
  • It would remain disabled and can be enabled only by dropping the foreign key constraint and re-creating it.

Question 62

Question
View the Exhibit and examine the structure of the LOCATIONS and DEPARTMENTS tables. Which SET operator should be used in the blank space in the following SQL statement to display the cities that have departments located in them? SELECT location_id, city FROM locations ____ SELECT location_id, city FROM locations JOIN departments USING(location_id);
Answer
  • UNION
  • MINUS
  • INTERSECT
  • UNION ALL

Question 63

Question
Which CREATE TABLE statement is valid?
Answer
  • CREATE TABLE ord_details (ord_no NUMBER(2) PRIMARY KEY, item_no NUMBER(3) PRIMARY KEY, ord_date date NOT NULL);
  • CREATE TABLE ord_details (ord_no NUMBER(2) UNIQUE, NOT NULL, item_no NUMBER(3), ord_date date DEFAULT SYSDATE NOT NULL);
  • CREATE TABLE ord_details (ord_no NUMBER(2) , item_no NUMBER(3), ord_date date DEFAULT NOT NULL, CONSTRAINT ord_uq UNIQUE (ord_no), CONSTRAINT ord_pk PRIMARY KEY (ord_no));
  • CREATE TABLE ord_details (ord_no NUMBER(2), item_no NUMBER(3), ord_date date DEFAULT SYSDATE NOT NULL, CONSTRAINT ord_pk PRIMARY KEY (ord_no, item_no));

Question 64

Question
Evaluate the following SELECT statement and view the Exhibit to examine its output: SELECT constraint_name, constraint_type, search_condition, r_constraint_name, delete_rule, status FROM user_constraints WHERE table_name = ORDERS Which two statements are true about the output? (Choose two.)
Answer
  • In the second column, indicates a check constraint.
  • The STATUS column indicates whether the table is currently in use.
  • The R_CONSTRAINT_NAME column gives the alternative name for the constraint.
  • The column DELETE_RULE decides the state of the related rows in the child table when the corresponding row is deleted from the parent table.

Question 65

Question
Which statement is true regarding Flashback Version Query?
Answer
  • It returns versions of rows only within a transaction.
  • It can be used in subqueries contained only in a SELECT statement.
  • It will return an error if the undo retention time is less than the lower bound time or SCN specified.
  • It retrieves all versions including the deleted as well as subsequently reinserted versions of the rows.

Question 66

Question
Which two statements are true regarding multiple-row subqueries? (Choose two.)
Answer
  • They can contain group functions.
  • They always contain a subquery within a subquery.
  • They use the < ALL operator to imply less than the maximum.
  • They can be used to retrieve multiple rows from a single table only.
  • They should not be used with the NOT IN operator in the main query if NULL is likely to be a part of the result of the subquery.

Question 67

Question
View the Exhibit and examine the structure of the ORDERS table. The columns ORDER_MODE and ORDER_TOTAL have the default values 'direct' and 0 respectively. Which two INSERT statements are valid? (Choose two.)
Answer
  • INSERT INTO orders VALUES (1, '09-mar-2007', 'online','',1000);
  • INSERT INTO orders (order_id,order_date,order_mode, customer_id,order_total) VALUES(1,TO_DATE(NULL), 'online', 101, NULL);
  • INSERT INTO (SELECT order_id,order_date,customer_id FROM orders) VALUES (1,'09-mar-2007', 101);
  • INSERT INTO orders VALUES (1,'09-mar-2007', DEFAULT, 101, DEFAULT);
  • INSERT INTO orders (order_id,order_date,order_mode,order_total) VALUES (1,'10-mar-2007','online',1000);

Question 68

Question
The following are the steps for a correlated subquery, listed in random order: 1) The WHERE clause of the outer query is evaluated. 2) The candidate row is fetched from the table specified in the outer query. 3) The procedure is repeated for the subsequent rows of the table, till all the rows are processed. 4) Rows are returned by the inner query, after being evaluated with the value from the candidate row in the outer query. Identify the option that contains the steps in the correct sequence in which the Oracle server evaluates a correlated subquery.
Answer
  • 4, 2, 1, 3
  • 4, 1, 2, 3
  • 2, 4, 1, 3
  • 2, 1, 4, 3

Question 69

Question
View the Exhibit and examine the structure of the EMPLOYEES table. Evaluate the following SQL statement: SELECT employee_id, last_name, job_id, manager_id FROM employees START WITH employee_id = 101 CONNECT BY PRIOR employee_id=manager_id; Which statement is true regarding the output for this command?
Answer
  • It would return a hierarchical output starting with the employee whose EMPLOYEE_ID is 101, followed by his or her peers.
  • It would return a hierarchical output starting with the employee whose EMPLOYEE_ID is 101, followed by the employee to whom he or she reports.
  • It would return a hierarchical output starting with the employee whose EMPLOYEE_ID is 101, followed by employees below him or her in the hierarchy.
  • It would return a hierarchical output starting with the employee whose EMPLOYEE_ID is101, followed by employees up to one level below him or her in the hierarchy.

Question 70

Question
Which two statements are true about the GROUPING function? (Choose two.)
Answer
  • It is used to find the groups forming the subtotal in a row.
  • It is used to identify the NULL value in the aggregate functions.
  • It is used to form the group sets involved in generating the totals and subtotals.
  • It can only be used with ROLLUP and CUBE operators specified in the GROUP BY clause.

Question 71

Question
Given below is a list of datetime data types and examples of values stored in them in a random order: Datatype Example 1)INTERVAL YEAR TO MONTH a) '2003-04-15 8:00:00 -8:00' 2)TIMESTAMP WITH LOCAL TIME ZONE b) '+06 03:30:16.000000' 3)TIMESTAMP WITH TIME ZONE c) '17-JUN-03 12.00.00.000000 AM' 4)INTERVAL DAY TO SECOND d) '+02-00' Identify the option that correctly matches the data types with the values.
Answer
  • 1-d, 2-c, 3-a, 4-b
  • 1-b, 2-a, 3-c, 4-d
  • 1-b, 2-a, 3-d, 4-c
  • 1-d, 2-c, 3-b, 4-a

Question 72

Question
View the Exhibit and examine the description of the PRODUCT_INFORMATION table. You want to display the expiration date of the warranty for a product. Which SQL statement would you execute?
Answer
  • SELECT product_id, SYSDATE + warranty_period FROM product_information;
  • SELECT product_id, TO_YMINTERVAL(warranty_period) FROM product_information;
  • SELECT product_id, TO_YMINTERVAL(SYSDATE) + warranty_period FROM product_information;
  • SELECT product_id, TO_YMINTERVAL(SYSDATE + warranty_period) FROM product_information;

Question 73

Question
View the Exhibit and examine the structure of the ORDERS table. NEW_ORDERS is a new table with the columns ORD_ID, ORD_DATE, CUST_ID, and ORD_TOTAL that have the same data types and size as the corresponding columns in the ORDERS table. Evaluate the following INSERT statement: INSERT INTO new_orders (ord_id, ord_date, cust_id, ord_total) VALUES(SELECT order_id,order_date,customer_id,order_total FROM orders WHERE order_date > '31-dec-1999'); Why would the INSERT statement fail?
Answer
  • because column names in NEW_ORDERS and ORDERS tables do not match
  • because the VALUES clause cannot be used in an INSERT with a subquery
  • because the WHERE clause cannot be used in a subquery embedded in an INSERT statement
  • because the total number of columns in the NEW_ORDERS table does not match the total number of columns in the ORDERS table

Question 74

Question
View the Exhibit and examine the structure of the ORDER_ITEMS and ORDERS tables. You are asked to retrieve the ORDER_ID, PRODUCT_ID, and total price (UNIT_PRICE multiplied by QUANTITY), where the total price is greater than 50,000. You executed the following SQL statement: SELECT order_id, product_id, unit_price*quantity "Total Price" FROM order_items WHERE unit_price*quantity > 50000 NATURAL JOIN orders; Which statement is true regarding the execution of the statement?
Answer
  • The statement would execute and provide the desired result.
  • The statement would not execute because the ON keyword is missing in the NATURAL JOIN clause.
  • The statement would not execute because the WHERE clause is before the NATURAL JOIN clause.
  • The statement would not execute because the USING keyword is missing in the NATURAL JOIN clause.

Question 75

Question
View the Exhibit and examine the structure of the EMPLOYEES table. You want to know the FIRST_NAME and SALARY for all employees who have the same manager as that of the employee with the first name 'Neena' and have salary equal to or greater than that of 'Neena'. Which SQL statement would give you the desired result?
Answer
  • SELECT first_name, salary FROM employees WHERE (manager_id, salary) >= ALL (SELECT manager_id, salary FROM employees WHERE first_name = 'Neena' ) AND first_name <> 'Neena';
  • SELECT first_name, salary FROM employees WHERE (manager_id, salary) >= (SELECT manager_id, salary FROM employees WHERE first_name = 'Neena' ) AND first_name <> 'Neena';
  • SELECT first_name, salary FROM employees WHERE (manager_id, salary) >= ANY (SELECT manager_id, salary FROM employees WHERE first_name = 'Neena' ) AND first_name <> 'Neena';
  • SELECT first_name, salary FROM employees WHERE ( manager_id = (SELECT manager_id FROM employees WHERE first_name = 'Neena' ) AND salary >= ( SELECT salary FROM employees WHERE first_name = 'Neena' ) ) AND first_name <> 'Neena';

Question 76

Question
View the Exhibit and examine the structure of the ORDERS table. Which UPDATE statement is valid?
Answer
  • UPDATE orders SET order_date = '12-mar-2007', order_total IS NULL WHERE order_id = 2455;
  • UPDATE orders SET order_date = '12-mar-2007', order_total = NULL WHERE order_id = 2455;
  • UPDATE orders SET order_date = '12-mar-2007' AND order_total = TO_NUMBER(NULL) WHERE order_id = 2455;
  • UPDATE orders SET order_date = TO_DATE('12-mar-2007','dd-mon-yyyy'), SET order_total = TO_NUMBER(NULL) WHERE order_id = 2455;

Question 77

Question
View the Exhibit and examine the descriptions for ORDERS and ORDER_ITEMS tables. Evaluate the following SQL statement: SELECT o.customer_id, oi.product_id, SUM(oi.unit_price*oi.quantity) "Order Amount" FROM order_items oi JOIN orders o ON oi.order_id = o.order_id GROUP BY CUBE (o.customer_id, oi.product_id); Which three statements are true regarding the output of this SQL statement? (Choose three.)
Answer
  • It would return the subtotals for the Order Amount of every CUSTOMER_ID.
  • It would return the subtotals for the Order Amount for every PRODUCT_ID.
  • It would return the subtotals for the Order Amount of every PRODUCT_ID and CUSTOMER_ID as one group.
  • It would return the subtotals for the Order Amount of every CUSTOMER_ID and PRODUCT_ID as one group.
  • It would return only the grand total for the Order Amount of every CUSTOMER_ID and PRODUCT_ID as one group.

Question 78

Question
View the Exhibit and examine the details of the EMPLOYEES table. You want to generate a hierarchical report for all the employees who report to the employee whose EMPLOYEE_ID is 100. Which SQL clauses would you require to accomplish the task? (Choose all that apply.)
Answer
  • WHERE
  • HAVING
  • GROUP BY
  • START WITH
  • CONNECT BY

Question 79

Question
View the Exhibit and examine the data in ORDERS_MASTER and MONTHLY_ORDERS tables. Evaluate the following MERGE statement: MERGE INTO orders_master o USING monthly_orders mON (o.order_id = m.order_id) WHEN MATCHED THEN UPDATE SET o.order_total = m.order_total DELETE WHERE (m.order_total IS NULL) WHEN NOT MATCHED THEN INSERT VALUES (m.order_id, m.order_total); What would be the outcome of the above statement?
Answer
  • The ORDERS_MASTER table would contain the ORDER_IDs 1 and 2.
  • The ORDERS_MASTER table would contain the ORDER_IDs 1, 2 and 3.
  • The ORDERS_MASTER table would contain the ORDER_IDs 1, 2 and 4.
  • The ORDERS_MASTER table would contain the ORDER_IDs 1, 2, 3 and 4.

Question 80

Question
Evaluate the following ALTER TABLE statement: ALTER TABLE orders SET UNUSED order_date; Which statement is true?
Answer
  • The DESCRIBE command would still display the ORDER_DATE column.
  • ROLLBACK can be used to get back the ORDER_DATE column in the ORDERS table.
  • The ORDER_DATE column should be empty for the ALTER TABLE command to execute successfully.
  • After executing the ALTER TABLE command, you can add a new column called ORDER_DATE to the ORDERS table.

Question 81

Question
View the Exhibit and examine the ORDERS table. The ORDERS table contains data and all orders have been assigned a customer ID. Which statement would add a NOT NULL constraint to the CUSTOMER_ID column?
Answer
  • ALTER TABLE orders ADD CONSTRAINT orders_cust_id_nn NOT NULL (customer_id);
  • ALTER TABLE orders MODIFY customer_id CONSTRAINT orders_cust_id_nn NOT NULL;
  • ALTER TABLE orders MODIFY CONSTRAINT orders_cust_id_nn NOT NULL (customer_id);
  • ALTER TABLE orders ADD customer_id NUMBER(6)CONSTRAINT orders_cust_id_nn NOT NULL;

Question 82

Question
Which three statements indicate the end of a transaction? (Choose three.)
Answer
  • after a COMMIT is issued
  • after a ROLLBACK is issued
  • after a SAVEPOINT is issued
  • after a SELECT statement is issued
  • after a CREATE statement is issued

Question 83

Question
View the Exhibit and examine the structure of the ORDERS table. You have to display ORDER_ID, ORDER_DATE, and CUSTOMER_ID for all those orders that were placed after the last order placed by the customer whose CUSTOMER_ID is 101. Which query would give you the desired output?
Answer
  • SELECT order_id, order_date FROM orders WHERE order_date > ALL (SELECT MAX(order_date) FROM orders ) AND customer_id = 101;
  • SELECT order_id, order_date FROM orders WHERE order_date > ANY (SELECT order_date FROM orders WHERE customer_id = 101);
  • SELECT order_id, order_date FROM orders WHERE order_date > ALL (SELECT order_date FROM orders WHERE customer_id = 101);
  • SELECT order_id, order_date FROM orders WHERE order_date IN (SELECT order_date FROM orders WHERE customer_id = 101);

Question 84

Question
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?
Answer
  • CREATE TABLE EMP_1 (emp_id NUMBER(4), emp_name VARCHAR2(25), start_date DATE, e_status VARCHAR2(10) DEFAULT 'ACTIVE', resume CLOB(200));
  • CREATE TABLE 1_EMP (emp_id NUMBER(4), emp_name VARCHAR2(25), start_date DATE, emp_status VARCHAR2(10) DEFAULT 'ACTIVE', resume CLOB);
  • CREATE TABLE 1_EMP (emp_id NUMBER(4), emp_name VARCHAR2(25), start_date DATE, emp_status VARCHAR2(10) DEFAULT "ACTIVE", resume CLOB);
  • CREATE TABLE EMP_1 (emp_id NUMBER, emp_name VARCHAR2(25), start_date DATE, emp_status VARCHAR2(10) DEFAULT 'ACTIVE', resume CLOB);

Question 85

Question
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?
Answer
  • Pivoting INSERT
  • Unconditional INSERT
  • Conditional ALL INSERT
  • Conditional FIRST INSERT

Question 86

Question
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?
Answer
  • The query would execute to give the desired output.
  • The query would not execute because date functions cannot be nested.
  • The query would execute but the output would give review dates that are Sundays.
  • The query would not execute because the NEXT_DAY function accepts a string as argument.

Question 87

Question
View the Exhibit and examine the structure of the EMPLOYEES table. You want to display all employees and their managers having 100 as the MANAGER_ID. You want the output in two columns: the first column would have the LAST_NAME of the managers and the second column would have LAST_NAME of the employees. Which SQL statement would you execute?
Answer
  • SELECT m.last_name "Manager", e.last_name "Employee" FROM employees m JOIN employees e ON m.employee_id = e.manager_id WHERE m.manager_id=100;
  • SELECT m.last_name "Manager", e.last_name "Employee" FROM employees m JOIN employees e ON m.employee_id = e.manager_id WHERE e.manager_id=100;
  • SELECT m.last_name "Manager", e.last_name "Employee" FROM employees m JOIN employees e ON e.employee_id = m.manager_id WHERE m.manager_id=100;
  • SELECT m.last_name "Manager", e.last_name "Employee" FROM employees m JOIN employees e WHERE m.employee_id = e.manager_id AND e.manager_id=100;

Question 88

Question
View the Exhibit1 and examine the descriptions of the EMPLOYEES and DEPARTMENTS tables. The following SQL statement was executed: SELECT e.department_id, e.job_id, d.location_id, sum(e.salary) total, GROUPING(e.department_id) GRP_DEPT, GROUPING(e.job_id) GRP_JOB, GROUPING(d.location_id) GRP_LOC FROM employees e JOIN departments d ON e.department_id = d.department_id GROUP BY ROLLUP (e.department_id, e.job_id, d.location_id); View the Exhibit2 and examine the output of the command. Which two statements are true regarding the output? (Choose two.)
Answer
  • The value 1 in GRP_LOC means that the LOCATION_ID column is taken into account to generate the subtotal.
  • The value 1 in GRP_JOB and GRP_LOC means that JOB_ID and LOCATION_ID columns are not taken into account to generate the subtotal.
  • The value 1 in GRP_JOB and GRP_LOC means that the NULL value in JOB_ID and LOCATION_ID columns are taken into account to generate the subtotal.
  • The value 0 in GRP_DEPT, GRP_JOB, and GRP_LOC means that DEPARTMENT_ID, JOB_ID, and LOCATION_ID columns are taken into account to generate the subtotal.
Show full summary Hide full summary

Similar

French Intermediate
PatrickNoonan
Criminal Law
jesusreyes88
Electromagnetism: Magnetic Flux Density & Magnetic Flux 2
tatemae.honne
Break-even Analysis - FLASH CARDS
Harshad Karia
English Poetry Key Words
Oliviax
Science Additional B3 - Animal and Plant Cells Flashcards
Stirling v
BELIEVING IN GOD- UNIT 1, SECTION 1- RELIGIOUS STUDIES GCSE EDEXCEL
Khadijah Mohammed
AQA GCSE Product Design Questions
Bella Statham
Testing for ions
Joshua Rees
Navegacion
Adriana Forero
1PR101 2.test - Část 16.
Nikola Truong