Pregunta 1
Pregunta
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?
Pregunta 2
Pregunta
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?
Respuesta
-
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 ;
Pregunta 3
Pregunta
Which three tasks can be performed using regular expression support in Oracle Database 10g? (Choose three.)
Respuesta
-
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.
Pregunta 4
Pregunta
Evaluate the following SQL statement:
ALTER TABLE emp
DROP COLUMN first_name;
Which two statements is true regarding the above command? (Choose two.)
Respuesta
-
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.
Pregunta 5
Pregunta
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?
Respuesta
-
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.
Pregunta 6
Pregunta
Which two statements are true?
Respuesta
-
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.
Pregunta 7
Pregunta
Which two WHERE clause conditions demonstrate the correct usage of conversion functions?
Respuesta
-
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') )
Pregunta 8
Pregunta
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?
Respuesta
-
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".
Pregunta 9
Pregunta
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?
Pregunta 10
Pregunta
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?
Respuesta
-
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.
Pregunta 11
Pregunta
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?
Respuesta
-
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) ;
Pregunta 12
Pregunta
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?
Respuesta
-
WHERE
-
HAVING
-
GROUP BY
-
START WITH
-
CONNECT BY PRIOR
Pregunta 13
Pregunta
Which two statements is true regarding the execution of the correlated subqueries?
Respuesta
-
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.
Pregunta 14
Pregunta
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?
Respuesta
-
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.
Pregunta 15
Pregunta
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?
Respuesta
-
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.
Pregunta 16
Pregunta
EMPDET is an external table containing the columns EMPNO and ENAME.
Which command would work in relation to the EMPDET table?
Respuesta
-
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);
Pregunta 17
Pregunta
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?
Respuesta
-
Pivoting INSERT
-
Unconditional INSERT
-
Conditional ALL INSERT
-
Conditional FIRST INSERT
Pregunta 18
Pregunta
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?
Respuesta
-
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;
Pregunta 19
Pregunta
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?
Respuesta
-
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.
Pregunta 20
Pregunta
In which scenario would you use the ROLLUP operator for expression or columns within a GROUP BY clause?
Respuesta
-
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
Pregunta 21
Pregunta
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?
Respuesta
-
xxx-xxx-xxxx
-
(xxx) xxxxxxx
-
(xxx) xxx-xxxx
-
xxx-(xxx)-xxxx
Pregunta 22
Pregunta
Which statement correctly grants a system privilege?
Respuesta
-
GRANT EXECUTE
ON proc1
TO PUBLIC;
-
GRANT CREATE VIEW
ON table1 TO
user1;
-
GRANT CREATE TABLE
TO user1,user2;
-
GRANT CREATE SESSION
TO ALL;
Pregunta 23
Pregunta
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?
Respuesta
-
row 4 only
-
rows 2 and 4
-
rows 3 and 4
-
rows 1 and 4
Pregunta 24
Pregunta
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?
Respuesta
-
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.
Pregunta 25
Pregunta
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?
Respuesta
-
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
Pregunta 26
Pregunta
Which statement is true regarding external tables?
Respuesta
-
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.
Pregunta 27
Pregunta
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?
Respuesta
-
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;
Pregunta 28
Pregunta
Which two statements are true regarding the EXISTS operator used in the correlated subqueries?
Respuesta
-
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.
Pregunta 29
Pregunta
A non-correlated subquery can be defined as ____.
Respuesta
-
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
Pregunta 30
Pregunta
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?
Pregunta 31
Pregunta
Which statements are true regarding the hierarchical query in Oracle Database 10g?
Respuesta
-
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.
Pregunta 32
Pregunta
Which two statements are true regarding views? (Choose two.)
Respuesta
-
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.
Pregunta 33
Pregunta
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.)
Respuesta
-
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.
Pregunta 34
Pregunta
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?
Respuesta
-
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.
Pregunta 35
Pregunta
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?
Respuesta
-
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.
Pregunta 36
Pregunta
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?
Respuesta
-
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.
Pregunta 37
Pregunta
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?
Respuesta
-
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.
Pregunta 38
Pregunta
Which statements are correct regarding indexes? (Choose all that apply.)
Respuesta
-
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.
Pregunta 39
Pregunta
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?
Respuesta
-
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;
Pregunta 40
Pregunta
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?
Respuesta
-
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.
Pregunta 41
Pregunta
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?
Respuesta
-
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.
Pregunta 42
Pregunta
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?
Respuesta
-
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.
Pregunta 43
Pregunta
Which statement best describes the GROUPING function?
Respuesta
-
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.
Pregunta 44
Pregunta
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.)
Respuesta
-
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);
Pregunta 45
Pregunta
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;
Respuesta
-
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.
Pregunta 46
Pregunta
Which two statements are true regarding operators used with subqueries? (Choose two.)
Respuesta
-
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.
Pregunta 47
Pregunta
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?
Respuesta
-
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.
Pregunta 48
Pregunta
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?
Respuesta
-
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.
Pregunta 49
Pregunta
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?
Respuesta
-
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.
Pregunta 50
Pregunta
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.)
Respuesta
-
ORDER BY 3;
-
ORDER BY 'b';
-
ORDER BY DEPT_ID;
-
ORDER BY DEPT_NAME;
Pregunta 51
Pregunta
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?
Respuesta
-
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;
Pregunta 52
Pregunta
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?
Respuesta
-
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.
Pregunta 53
Pregunta
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?
Respuesta
-
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);
Pregunta 54
Pregunta
Which two statements are true about sequences created in a single instance database? (Choose two.)
Respuesta
-
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.
Pregunta 55
Pregunta
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;
Respuesta
-
UNION
-
MINUS
-
INTERSECT
-
UNION ALL
Pregunta 56
Pregunta
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'));
Respuesta
-
TYPE
-
REJECT LIMIT
-
DEFAULT DIRECTORY
-
ACCESS PARAMETERS
Pregunta 57
Pregunta
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?
Respuesta
-
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.
Pregunta 58
Pregunta
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?
Respuesta
-
MERGE
-
Unconditional INSERT
-
Conditional ALL INSERT
-
Conditional FIRST INSERT
Pregunta 59
Pregunta
Which statement is true regarding the ROLLUP operator specified in the GROUP BY clause of a SQL statement?
Respuesta
-
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.
Pregunta 60
Pregunta
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?
Respuesta
-
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.
Pregunta 61
Pregunta
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?
Respuesta
-
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.
Pregunta 62
Pregunta
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);
Respuesta
-
UNION
-
MINUS
-
INTERSECT
-
UNION ALL
Pregunta 63
Pregunta
Which CREATE TABLE statement is valid?
Respuesta
-
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));
Pregunta 64
Pregunta
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.)
Respuesta
-
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.
Pregunta 65
Pregunta
Which statement is true regarding Flashback Version Query?
Respuesta
-
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.
Pregunta 66
Pregunta
Which two statements are true regarding multiple-row subqueries? (Choose two.)
Respuesta
-
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.
Pregunta 67
Pregunta
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.)
Respuesta
-
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);
Pregunta 68
Pregunta
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.
Respuesta
-
4, 2, 1, 3
-
4, 1, 2, 3
-
2, 4, 1, 3
-
2, 1, 4, 3
Pregunta 69
Pregunta
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?
Respuesta
-
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.
Pregunta 70
Pregunta
Which two statements are true about the GROUPING function? (Choose two.)
Respuesta
-
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.
Pregunta 71
Pregunta
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.
Respuesta
-
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
Pregunta 72
Pregunta
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?
Respuesta
-
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;
Pregunta 73
Pregunta
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?
Respuesta
-
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
Pregunta 74
Pregunta
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?
Respuesta
-
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.
Pregunta 75
Pregunta
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?
Respuesta
-
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';
Pregunta 76
Pregunta
View the Exhibit and examine the structure of the ORDERS table.
Which UPDATE statement is valid?
Respuesta
-
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;
Pregunta 77
Pregunta
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.)
Respuesta
-
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.
Pregunta 78
Pregunta
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.)
Respuesta
-
WHERE
-
HAVING
-
GROUP BY
-
START WITH
-
CONNECT BY
Pregunta 79
Pregunta
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?
Respuesta
-
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.
Pregunta 80
Pregunta
Evaluate the following ALTER TABLE statement:
ALTER TABLE orders
SET UNUSED order_date;
Which statement is true?
Respuesta
-
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.
Pregunta 81
Pregunta
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?
Respuesta
-
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;
Pregunta 82
Pregunta
Which three statements indicate the end of a transaction? (Choose three.)
Respuesta
-
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
Pregunta 83
Pregunta
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?
Respuesta
-
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);
Pregunta 84
Pregunta
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?
Respuesta
-
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);
Pregunta 85
Pregunta
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?
Respuesta
-
Pivoting INSERT
-
Unconditional INSERT
-
Conditional ALL INSERT
-
Conditional FIRST INSERT
Pregunta 86
Pregunta
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?
Respuesta
-
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.
Pregunta 87
Pregunta
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?
Respuesta
-
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;
Pregunta 88
Pregunta
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.)
Respuesta
-
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.