Quiz
Questionário - Manipuling Data / Manipulating Large Data Sets
Erstelle ein kostenloses Konto, um dieses Quiz zu beenden
Speichere deinen Fortschritt und sieh dir dein Endergebnis an.
oder mit deiner E-Mail registrieren
Schon ein Konto? Anmelden
Fragen in diesem Quiz (84)
1You 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?
- Aexternal table
- Bthe MERGE command
- Cthe multitable INSERT command
- DINSERT using WITH CHECK OPTION
2Evaluate 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?- AIt would be created only if a unique index is manually created first.
- BIt would be created and would use an automatically created unique index.
- CIt would be created and would use an automatically created no unique index.
- DIt would be created and remains in a disabled state because no index is specified in the command.
3Which two statements are true?
- AThe USER_SYNONYMS view can provide information about private synonyms.
- BThe user SYSTEM owns all the base tables and user-accessible views of the data dictionary.
- CAll the dynamic performance views prefixed with V$ are accessible to all the database users.
- DThe USER_OBJECTS view can provide information about the tables and views created by the user only.
- EDICTIONARY is a view that contains the namesof all the data dictionary views that the user can access.
4View 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?
- AChange the SELECT clause to SELECT last_name, department_id, salary*12+50 "Annual Compensation".
- BChange the SELECT clause to SELECT last_name, department_id, salary+(50*12) "Annual Compensation".
- CChange the SELECT clause to SELECT last_name, department_id, (salary+50)*12 "Annual Compensation".
- DChange the SELECT clause to SELECT last_name, department_id, (salary*12)+50 "Annual Compensation".
5Evaluate 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?- A1
- B10
- C100
- Dan error
6View 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?
- AThe WHERE clause condition in the main query is using the = comparison operator, instead of EXISTS.
- BThe WHERE clause condition in the main query is using the = comparison operator, instead of
the IN operator. - CThe WHERE clause condition in the main query is using the = comparison operator, instead of
the = ANY operator. - DThe columns in the WHERE clause condition ofthe main query and the columns selected in
the subquery should be in the same order.
7View 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?
- ASELECT 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; - BSELECT 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; - CSELECT 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; - DSELECT 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) ;
- ASELECT o.customer_id, oi.product_id, SUM(oi.unit_price*oi.quantity) "Total" FROM
8View 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?
- AWHERE
- BHAVING
- CGROUP BY
- DSTART WITH
- ECONNECT BY PRIOR
9Which two statements is true regarding the execution of the correlated subqueries?
- AThe nested query executes after the outer query returns the row.
- BThe nested query executes first and then the outer query executes.
- CThe outer query executes only once for the result returned by the inner query.
- DEach row returned by the outer query is evaluated for the results returned by the inner query.
10OE 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?- ASCOTT would be able to query the OE.ORDERS table.
- BSCOTT would not be able to query the OE.ORDERS table.
- CThe REVOKE statement would remove the SELECT privilege from SCOTT as well as from the
role R1. - DThe REVOKE statement would give an error because the SELECT privilege has been granted
to the role R1.
11Evaluate the following SQL statement:
ALTER TABLE hr.emp
SET UNUSED (mgr_id);
Which statement is true regarding the effect of the above SQL statement?- AAny synonym existing on the EMP table would have to be re-created.
- BAny constraints defined on the MGR_ID column would be removed by the above command.
- CAny views created on the EMP table that include the MGR_ID column would have to be dropped and re-created.
- DAny index created on the MGR_ID column would continue to exist until the DROP UNUSED COLUMNS command is executed.
12EMPDET is an external table containing the columns EMPNO and ENAME.
Which command would work in relation to the EMPDET table?- AUPDATE empdet
SET ename = 'Amit'
WHERE empno = 1234; - BDELETE FROM empdet
WHERE ename LIKE 'J%'; - CCREATE VIEW empvu
AS
SELECT * FROM empdept; - DCREATE INDEX empdet_idx
ON empdet(empno);
- AUPDATE empdet
13View 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?
- APivoting INSERT
- BUnconditional INSERT
- CConditional ALL INSERT
- DConditional FIRST INSERT
14View 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?
- ACREATE 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; - BCREATE 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; - CCREATE 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; - DCREATE 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;
- ACREATE OR REPLACE VIEW ord_vu (order_id,order_date)
15View 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?
- AThe statement would execute successfully to produce the required output.
- BThe statement would not execute because inline views and outer joins cannot be used together.
- CThe statement would not execute because the ITEM_CNT alias cannot be displayed in the
outer query. - DThe statement would not execute because the GROUP BY clause cannot be used in the inline
view.
16In which scenario would you use the ROLLUP operator for expression or columns within a GROUP BY clause?
- Ato find the groups forming the subtotal in a row
- Bto create group-wise grand totals for the groups specified within a GROUP BY clause
- Cto create a grouping for expressions or columns specified within a GROUP BY clause in one direction, from right to left for calculating the subtotals
- Dto 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
17View 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?
- Axxx-xxx-xxxx
- B(xxx) xxxxxxx
- C(xxx) xxx-xxxx
- Dxxx-(xxx)-xxxx
18Which statement correctly grants a system privilege?
- AGRANT EXECUTE
ON proc1
TO PUBLIC; - BGRANT CREATE VIEW
ON table1 TO
user1; - CGRANT CREATE TABLE
TO user1,user2; - DGRANT CREATE SESSION
TO ALL;
- AGRANT EXECUTE
19View 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?
- Arow 4 only
- Brows 2 and 4
- Crows 3 and 4
- Drows 1 and 4
20View 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?
- AIt would execute successfully and the new row would be inserted into a new temporary table created by the subquery.
- BIt would execute successfully and the ORDER_TOTAL column would have the value 1000 inserted automatically in the new row.
- CIt would not execute successfully because the ORDER_TOTAL column is not specified in the SELECT list and no value is provided for it.
- DIt 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.
21View 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?
- AIt would execute and give you the desired output.
- BIt would not execute because the AS keyword is missing between the column name and the alias.
- CIt would not execute because double quotation marks are used instead of single quotation marks for assigning alias for the third column.
- DIt would execute but the result for the third column would be inaccurate because the parentheses for overriding the precedence of the operator are missing
22Which statement is true regarding external tables?
- AThe default REJECT LIMIT for external tables is UNLIMITED.
- BThe data and metadata for an externaltable are stored outside the database.
- CORACLE_LOADER and ORACLE_DATAPUMP have exactly the same functionality when used with an external table.
- DThe CREATE TABLE AS SELECT statement can be used to unload data into regular table in the database from an external table.
23View 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?
- ASELECT product_name, category_id, SYSDATE+warranty_period AS "Warranty expire date"
FROM product_information ORDER BY SYSDATE-warranty_period; - BSELECT product_name, category_id, SYSDATE+warranty_period AS "Warranty expire date"
FROM product_information ORDER BY SYSDATE+warranty_period; - CSELECT product_name, category_id, SYSDATE+warranty_period AS "Warranty expire date"
FROM product_information ORDER BY SYSDATE; - DSELECT product_name, category_id, SYSDATE+warranty_period "Warranty expire date"
FROM product_information WHERE warranty_period >SYSDATE;
- ASELECT product_name, category_id, SYSDATE+warranty_period AS "Warranty expire date"
24Which two statements are true regarding the EXISTS operator used in the correlated subqueries?
- AThe outer query stops evaluating the result set ofthe inner query when the first value is found.
- BIt is used to test whether the values retrieved by the inner query exist in the result of the outer query.
- CIt is used to test whether the values retrieved by the outer query exist in the result set of the inner query.
- DThe outer query continues evaluating the result set of the inner query until all the values in the result set are processed.
25A non-correlated subquery can be defined as ____.
- Aa set of sequential queries, all of which must always return a single value
- Ba set of sequential queries, all of which must return values from the same table
- Ca SELECT statement that can be embedded ina clause of another SELECT statement only
- Da 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
26You 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?- AINTERVAL YEAR TO MONTH
- BINTERVAL DAY TO SECOND
- CTIMESTAMP WITH TIME ZONE
- DTIMESTAMP WITH LOCAL TIME ZONE
27Which statements are true regarding the hierarchical query in Oracle Database 10g?
- AIt is possible to retrieve data only in top-down hierarchy.
- BIt is possible to retrieve data in top-down or bottom-up hierarchy.
- CIt is possible to remove an entire branch from the output of the hierarchical query.
- DYou cannot specify conditions when you retrieve data by using a hierarchical query.
28Which two statements are true regarding views? (Choose two.)
- AA simple view in which column aliases have been used cannot be updated.
- BA subquery used in a complex view definition cannot contain group functions or joins.
- CRows cannot be deleted through a view if the view definition contains the DISTINCT keyword.
- DRows added through a view are deleted from the table automatically when the view is dropped.
- EThe OR REPLACE option is used to change the definition of an existing view without dropping and re-creating it.
- FThe WITH CHECK OPTION constraint can be used in a view definition to restrict the columns displayed through the view.
29View 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.)
- AStatement 1 would return only one row of output.
- BBoth the statements would give the same output.
- CStatement 2 would return multiple rows of output.
- DStatement 1 would not return any row because the GROUP BY clause is missing.
- EBoth statements would ignore NULL values for the UNIT_PRICE and QUANTITY columns.
30View 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?
- AThe statement would not execute because table aliases are not allowed in the JOIN clause.
- BThe statement would not execute because the table alias prefix is not used in the USING clause.
- CThe statement would not execute because all the columns in the SELECT clause are not prefixed with table aliases.
- DThe statement would not execute because the column part of the USING clause cannot have a qualifier in the SELECT list.
31Evaluate 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?- AIt recovers only the first DEPT table.
- BIt recovers only the second DEPT table.
- CIt does not recover any of the tables because FLASHBACK is not possible in this case.
- DIt recovers both the tables but the names would be changed to the ones assigned in the RECYCLEBIN.
32Evaluate 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?- AIt would not display any values.
- BIt would display the value TWO once.
- CIt would display the value TWO twice.
- DIt would display the values ONE, TWO, and TWO.
33View 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?
- AIt would not execute because 'June 30 2001' in the WHERE condition is not enclosed within double quotation marks.
- BIt would execute and would return ORDER_ID and CUSTOMER_ID for all records having ORDER_DATE greater than 'June 30 2001'.
- CIt 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.
- DIt 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.
34Which statements are correct regarding indexes? (Choose all that apply.)
- AWhen a table is dropped, the corresponding indexes are automatically dropped.
- BFor each DML operation performed, the corresponding indexes are automatically updated.
- CIndexes should be created on columns that are frequently referenced as part of an expression.
- DA non-deferrable PRIMARY KEY or UNIQUE KEY constraint in a table automatically creates a
unique index.
35View 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?
- ASELECT COUNT(list_price)
FROM product_information
WHERE list_price IS NULL; - BSELECT COUNT(list_price)
FROM product_information
WHERE list_price = NULL; - CSELECT COUNT(NVL(list_price, 0))
FROM product_information
WHERE list_price IS NULL; - DSELECT COUNT(DISTINCT list_price)
FROM product_information
WHERE list_price IS NULL;
- ASELECT COUNT(list_price)
36User 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?- AThe user SCOTT loses the privilege to select rows from OE.ORDERS.
- BThe user SCOTT retains the privilege to select rows from OE.ORDERS.
- CThe REVOKE statement generates an error because OE has to first revoke the SELECT privilege from SCOTT.
- DThe REVOKE statement generates an error because the ALL keyword cannot be used for privileges that have been granted using WITH GRANT OPTION.
37View 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?
- AThe PRIMARY KEY is created along with a new index.
- BThe PRIMARY KEY is created and it would use an existing unique index.
- CThe PRIMARY KEY would be created in a disabled state because it is using an existing index.
- DThe statement produces an error because the USING clause is permitted only in the CREATE TABLE command.
38SCOTT 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?- AStatement 1 would not execute because the WITH GRANT option is missing.
- BStatement 1 would not execute because the IDENTIFIED BY <password> clause is missing.
- CStatement 3 would not execute because role and system privileges cannot be granted together in a single GRANT statement.
- DStatement 2 would not execute because system privileges and object privileges cannot be granted together in a single GRANT command.
39Which statement best describes the GROUPING function?
- AIt is used to set the order for the groups to be used for calculating the grand totals and subtotals.
- BIt is used to form various groups to calculate total and subtotals created using ROLLUP and CUBE operators.
- CIt is used to identify if the NULL value in an expression is a stored NULL value or created by ROLLUP or CUBE.
- DIt is used to specify the concatenated group expressions to be used for calculating the grand totals and subtotals.
40View 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.)
- ACREATE INDEX ord_idx
ON ord(ord_no); - BCREATE INDEX ord_idx
ON ord_items(ord_no); - CCREATE INDEX ord_idx
ON ord_items(item_no); - DCREATE INDEX ord_idx
ON ord,ord_items(ord_no, ord_date,qty);
- ACREATE INDEX ord_idx
41View 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;
- AThe CUSTOMER_ID column cannot be updated.
- BThe INTO clause is misplaced in the command.
- CThe WHERE clause cannot be used with INSERT.
- DCUSTOMER_VU cannot be used as a data source.
42Which two statements are true regarding operators used with subqueries? (Choose two.)
- AThe NOT IN operator is equivalent to IS NULL.
- BThe <ANY operator means less than the maximum.
- C=ANY and =ALL operators have the same functionality.
- DThe IN operator cannot be used in single-row subqueries.
- EThe NOT operator can be used with IN, ANY and ALL operators.
43Given 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?- ANo SQL statement would be rolled back.
- BBoth the DELETE statements would be rolled back.
- COnly the second DELETE statement would be rolled back.
- DBoth the DELETE statements and the UPDATE statement would be rolled back.
44Evaluate 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?- AIt would execute successfully and only ORD_ITM_IDX index would be created.
- BIt would give an error because the USING INDEX clause cannot be used on a composite primary key.
- CIt would execute successfully and two indexes ORD_ITM_IDX and ORD_ITM_ID_PK would be created.
- DIt would give an error because the USING INDEX clause is not permitted in the CREATE TABLE command.
45View 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?
- AThe statement would execute and give the desired results.
- BThe statement would not execute because the = ANY comparison operator is used instead of =.
- CThe statement would not execute because the main query block uses the query name before it is even created.
- DThe statement would not execute because the comma is missing between the main query block and the query name.
46View 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.)
- AORDER BY 3;
- BORDER BY 'b';
- CORDER BY DEPT_ID;
- DORDER BY DEPT_NAME;
47View 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?
- ASELECT employee_id, first_name
FROM employees
WHERE job_id like 'MAN%' OR job_id like 'CLERK%'
AND department_id = 30 AND salary > 3000; - BSELECT employee_id, first_name
FROM employees
WHERE job_id like '%MAN' OR job_id like '%CLERK'
AND (department_id = 30 OR salary > 3000); - CSELECT employee_id, first_name
FROM employees
WHERE (job_id like '%MAN' AND job_id like '%CLERK')
AND department_id = 30 OR salary > 3000; - DSELECT employee_id, first_name
FROM employees
WHERE (job_id like '%MAN' OR job_id like '%CLERK' )
AND department_id = 30 AND salary > 3000;
- ASELECT employee_id, first_name
48View 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?
- AStatement 1 by user OE would not work because the statement has to be issued by the DBA.
- BStatement 2 by user HR would not work because the grant is only for SELECT in a subquery of update.
- CThere are no errors in the statements issued by OE and HR; all the statements would execute successfully.
- DStatement 1 by user HR would not work because SELECT and UPDATE privileges have been granted only on CUSTOMER_ID and ORDER_TOTAL columns.
49View 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?
- ASELECT order_id
FROM order_items
WHERE(unit_price*quantity) = MAX(unit_price*quantity)
GROUP BY order_id; - BSELECT order_id
FROM order_items
WHERE(unit_price*quantity) = (SELECT MAX(unit_price*quantity)
FROM order_items)
GROUP BY order_id; - CSELECT order_id
FROM order_items
WHERE (unit_price*quantity) = (SELECT MAX(unit_price*quantity)
FROM order_items
GROUP BY order_id); - DSELECT 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);
- ASELECT order_id
50Which two statements are true about sequences created in a single instance database? (Choose two.)
- AThe numbers generated by a sequence can be used only for one table.
- BDELETE <sequencename> would remove a sequence from the database.
- CCURRVAL is used to refer to the last sequence number that has been generated.
- DWhen the MAXVALUE limit for a sequence is reached, you can increase the MAXVALUE limit by using the ALTER SEQUENCE statement.
- EWhen 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.
51View 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;
- AUNION
- BMINUS
- CINTERSECT
- DUNION ALL
52Which 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'));- ATYPE
- BREJECT LIMIT
- CDEFAULT DIRECTORY
- DACCESS PARAMETERS
53View 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?
- AThe query would return the ORDER_ID and PRODUCT_ID for only those products that are ordered.
- BThe 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
- CThe query would return the ORDER_ID and PRODUCT_ID for the products that are ordered but not listed in the PRODUCT_INFORMATION table.
- DThe 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.
54Evaluate 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?- AMERGE
- BUnconditional INSERT
- CConditional ALL INSERT
- DConditional FIRST INSERT
55Which statement is true regarding the ROLLUP operator specified in the GROUP BY clause of a SQL statement?
- AIt produces only the subtotals for the groups specified in the GROUP BY clause.
- BIt produces only the grand totals for the groups specified in the GROUP BY clause.
- CIt produces higher-level subtotals, moving from right to left through the list of grouping columns specified in the GROUP BY clause.
- DIt produces higher-level subtotals, moving in all the directions through the list of grouping
columns specified in the GROUP BY clause.
56View 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?
- AThe statement would execute and would return the desired results.
- BThe statement would not execute because the = comparison operator is missing in the WHERE clause of the outer query.
- CThe statement would execute but it will return zero rows because the WHERE clause in the inner query should have the = operator instead of <>.
- DThe statement would not execute because the WHERE clause in the outer query is missing
the column name for comparison with the inner query result.
57Evaluate 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?- AIt would be automatically enabled and deferred.
- BIt would be automatically enabled and immediate.
- CIt would remain disabled and has to be enabled manually using the ALTER TABLE command.
- DIt would remain disabled and can be enabled only by dropping the foreign key constraint and re-creating it.
58View 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);
- AUNION
- BMINUS
- CINTERSECT
- DUNION ALL
59Which CREATE TABLE statement is valid?
- ACREATE TABLE ord_details
(ord_no NUMBER(2) PRIMARY KEY,
item_no NUMBER(3) PRIMARY KEY,
ord_date date NOT NULL); - BCREATE TABLE ord_details
(ord_no NUMBER(2) UNIQUE, NOT NULL,
item_no NUMBER(3),
ord_date date DEFAULT SYSDATE NOT NULL); - CCREATE 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)); - DCREATE 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));
- ACREATE TABLE ord_details
60Evaluate 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.)
- AIn the second column, indicates a check constraint.
- BThe STATUS column indicates whether the table is currently in use.
- CThe R_CONSTRAINT_NAME column gives the alternative name for the constraint.
- DThe column DELETE_RULE decides the state of the related rows in the child table when the corresponding row is deleted from the parent table.
61Which statement is true regarding Flashback Version Query?
- AIt returns versions of rows only within a transaction.
- BIt can be used in subqueries contained only in a SELECT statement.
- CIt will return an error if the undo retention time is less than the lower bound time or SCN specified.
- DIt retrieves all versions including the deleted as well as subsequently reinserted versions of the rows.
62Which two statements are true regarding multiple-row subqueries? (Choose two.)
- AThey can contain group functions.
- BThey always contain a subquery within a subquery.
- CThey use the < ALL operator to imply less than the maximum.
- DThey can be used to retrieve multiple rows from a single table only.
- EThey 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.
63View 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.)
- AINSERT INTO orders
VALUES (1, '09-mar-2007', 'online','',1000); - BINSERT INTO orders
(order_id,order_date,order_mode,
customer_id,order_total)
VALUES(1,TO_DATE(NULL), 'online', 101, NULL); - CINSERT INTO
(SELECT order_id,order_date,customer_id
FROM orders)
VALUES (1,'09-mar-2007', 101); - DINSERT INTO orders
VALUES (1,'09-mar-2007', DEFAULT, 101, DEFAULT); - EINSERT INTO orders
(order_id,order_date,order_mode,order_total)
VALUES (1,'10-mar-2007','online',1000);
- AINSERT INTO orders
64The 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.- A4, 2, 1, 3
- B4, 1, 2, 3
- C2, 4, 1, 3
- D2, 1, 4, 3
65View 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?
- AIt would return a hierarchical output starting with the employee whose EMPLOYEE_ID is 101, followed by his or her peers.
- BIt would return a hierarchical output starting with the employee whose EMPLOYEE_ID is 101, followed by the employee to whom he or she reports.
- CIt would return a hierarchical output starting with the employee whose EMPLOYEE_ID is 101, followed by employees below him or her in the hierarchy.
- DIt 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.
66Which two statements are true about the GROUPING function? (Choose two.)
- AIt is used to find the groups forming the subtotal in a row.
- BIt is used to identify the NULL value in the aggregate functions.
- CIt is used to form the group sets involved in generating the totals and subtotals.
- DIt can only be used with ROLLUP and CUBE operators specified in the GROUP BY clause.
67Given 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.- A1-d, 2-c, 3-a, 4-b
- B1-b, 2-a, 3-c, 4-d
- C1-b, 2-a, 3-d, 4-c
- D1-d, 2-c, 3-b, 4-a
68View 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?
- ASELECT product_id, SYSDATE + warranty_period
FROM product_information; - BSELECT product_id, TO_YMINTERVAL(warranty_period)
FROM product_information; - CSELECT product_id, TO_YMINTERVAL(SYSDATE) + warranty_period
FROM product_information; - DSELECT product_id, TO_YMINTERVAL(SYSDATE + warranty_period)
FROM product_information;
- ASELECT product_id, SYSDATE + warranty_period
69View 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?
- Abecause column names in NEW_ORDERS and ORDERS tables do not match
- Bbecause the VALUES clause cannot be used in an INSERT with a subquery
- Cbecause the WHERE clause cannot be used in a subquery embedded in an INSERT statement
- Dbecause the total number of columns in the NEW_ORDERS table does not match the total number of columns in the ORDERS table
70View 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?
- AThe statement would execute and provide the desired result.
- BThe statement would not execute because the ON keyword is missing in the NATURAL JOIN clause.
- CThe statement would not execute because the WHERE clause is before the NATURAL JOIN clause.
- DThe statement would not execute because the USING keyword is missing in the NATURAL JOIN clause.
71View 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?
- ASELECT first_name, salary
FROM employees
WHERE (manager_id, salary) >= ALL (SELECT manager_id, salary
FROM employees
WHERE first_name = 'Neena' )
AND first_name <> 'Neena'; - BSELECT first_name, salary
FROM employees
WHERE (manager_id, salary) >= (SELECT manager_id, salary
FROM employees
WHERE first_name = 'Neena' )
AND first_name <> 'Neena'; - CSELECT first_name, salary
FROM employees
WHERE (manager_id, salary) >= ANY (SELECT manager_id, salary
FROM employees
WHERE first_name = 'Neena' )
AND first_name <> 'Neena'; - DSELECT 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';
- ASELECT first_name, salary
72View the Exhibit and examine the structure of the ORDERS table.
Which UPDATE statement is valid?
- AUPDATE orders
SET order_date = '12-mar-2007',
order_total IS NULL
WHERE order_id = 2455; - BUPDATE orders
SET order_date = '12-mar-2007',
order_total = NULL
WHERE order_id = 2455; - CUPDATE orders
SET order_date = '12-mar-2007'
AND order_total = TO_NUMBER(NULL)
WHERE order_id = 2455; - DUPDATE orders
SET order_date = TO_DATE('12-mar-2007','dd-mon-yyyy'),
SET order_total = TO_NUMBER(NULL)
WHERE order_id = 2455;
- AUPDATE orders
73View 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.)
- AIt would return the subtotals for the Order Amount of every CUSTOMER_ID.
- BIt would return the subtotals for the Order Amount for every PRODUCT_ID.
- CIt would return the subtotals for the Order Amount of every PRODUCT_ID and CUSTOMER_ID as one group.
- DIt would return the subtotals for the Order Amount of every CUSTOMER_ID and PRODUCT_ID as one group.
- EIt would return only the grand total for the Order Amount of every CUSTOMER_ID and PRODUCT_ID as one group.
74View 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.)
- AWHERE
- BHAVING
- CGROUP BY
- DSTART WITH
- ECONNECT BY
75View 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?
- AThe ORDERS_MASTER table would contain the ORDER_IDs 1 and 2.
- BThe ORDERS_MASTER table would contain the ORDER_IDs 1, 2 and 3.
- CThe ORDERS_MASTER table would contain the ORDER_IDs 1, 2 and 4.
- DThe ORDERS_MASTER table would contain the ORDER_IDs 1, 2, 3 and 4.
76Evaluate the following ALTER TABLE statement:
ALTER TABLE orders
SET UNUSED order_date;
Which statement is true?- AThe DESCRIBE command would still display the ORDER_DATE column.
- BROLLBACK can be used to get back the ORDER_DATE column in the ORDERS table.
- CThe ORDER_DATE column should be empty for the ALTER TABLE command to execute
successfully. - DAfter executing the ALTER TABLE command, you can add a new column called
ORDER_DATE to the ORDERS table.
77View 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?
- AALTER TABLE orders
ADD CONSTRAINT orders_cust_id_nn NOT NULL (customer_id); - BALTER TABLE orders
MODIFY customer_id CONSTRAINT orders_cust_id_nn NOT NULL; - CALTER TABLE orders
MODIFY CONSTRAINT orders_cust_id_nn NOT NULL (customer_id); - DALTER TABLE orders
ADD customer_id NUMBER(6)CONSTRAINT orders_cust_id_nn NOT NULL;
- AALTER TABLE orders
78Which three statements indicate the end of a transaction? (Choose three.)
- Aafter a COMMIT is issued
- Bafter a ROLLBACK is issued
- Cafter a SAVEPOINT is issued
- Dafter a SELECT statement is issued
- Eafter a CREATE statement is issued
79View 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?
- ASELECT order_id, order_date FROM orders
WHERE order_date > ALL (SELECT MAX(order_date)
FROM orders ) AND
customer_id = 101; - BSELECT order_id, order_date FROM orders
WHERE order_date > ANY (SELECT order_date
FROM orders
WHERE customer_id = 101); - CSELECT order_id, order_date FROM orders
WHERE order_date > ALL (SELECT order_date
FROM orders
WHERE customer_id = 101); - DSELECT order_id, order_date FROM orders
WHERE order_date IN (SELECT order_date
FROM orders
WHERE customer_id = 101);
- ASELECT order_id, order_date FROM orders
80You 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?- ACREATE TABLE EMP_1
(emp_id NUMBER(4),
emp_name VARCHAR2(25),
start_date DATE,
e_status VARCHAR2(10) DEFAULT 'ACTIVE',
resume CLOB(200)); - BCREATE TABLE 1_EMP
(emp_id NUMBER(4),
emp_name VARCHAR2(25),
start_date DATE,
emp_status VARCHAR2(10) DEFAULT 'ACTIVE',
resume CLOB); - CCREATE TABLE 1_EMP
(emp_id NUMBER(4),
emp_name VARCHAR2(25),
start_date DATE,
emp_status VARCHAR2(10) DEFAULT "ACTIVE",
resume CLOB); - DCREATE TABLE EMP_1
(emp_id NUMBER,
emp_name VARCHAR2(25),
start_date DATE,
emp_status VARCHAR2(10) DEFAULT 'ACTIVE',
resume CLOB);
- ACREATE TABLE EMP_1
81The 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?
- APivoting INSERT
- BUnconditional INSERT
- CConditional ALL INSERT
- DConditional FIRST INSERT
82View 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?
- AThe query would execute to give the desired output.
- BThe query would not execute because date functions cannot be nested.
- CThe query would execute but the output would give review dates that are Sundays.
- DThe query would not execute because the NEXT_DAY function accepts a string as argument.
83View 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?
- ASELECT 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; - BSELECT 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; - CSELECT 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; - DSELECT 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;
- ASELECT m.last_name "Manager", e.last_name "Employee"
84View 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.)
- AThe value 1 in GRP_LOC means that the LOCATION_ID column is taken into account to generate the subtotal.
- BThe 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.
- CThe 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.
- DThe 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.
Informationen
- Beschreibung
- Oracle Certified Associate Oracle - SQL/PLSQL Quiz am Questionário - Manipuling Data / Manipulating Large Data Sets, erstellt von RENATO PASQUINI am 19/05/2016.
- Autor
- RENATO PASQUINI
- Sprache
- Português
- Aufrufe
- 1
- Schlagwörter
- Bewertung
- Noch keine Bewertungen Bewerte dieses Quiz