Get Full Version of the Exam
http://www.EnsurePass.com/1z0-061.html
Question No.311
Which two statements are true regarding constraints? (Choose two.)
-
A table can have only one primary key and one foreign key.
-
A table can have only one primary key but multiple foreign keys.
-
Only the primary key can be defined at the column and table levels.
-
The foreign key and parent table primary key must have the same name.
-
Both primary key and foreign key constraints can be defined at both column and table levels.
Correct Answer: BE
Question No.312
Evaluate this SQL statement:
SELECT ename, sal, 12*sal 100 FROM emp;
The SAL column stores the monthly salary of the employee. Which change must be made to the above syntax to calculate the annual compensation as quot;monthly salary plus a monthly bonus of
$100, multiplied by 12quot;?
-
No change is required to achieve the desired results.
-
SELECT ename, sal, 12*(sal 100) FROM emp;
-
SELECT ename, sal, (12*sal) 100 FROM emp;
-
SELECT ename, sal 100, *12 FROM emp;
Correct Answer: B
Explanation:
To achieve the result you must add 100 to sal before multiply with 12. Select ename, sal, 12*(sal 100) from EMP;
Incorrect answer:
A. Multiplication and division has priority over addition and subtraction in Operator precedence.
-
Give wrong results
-
Wrong syntax
Refer: Introduction to Oracle9i: SQL, Oracle University Study Guide, 1-11
Question No.313
View the Exhibit and examine the structure of the PRODUCTS table.
You want to display the category with the maximum number of items. You issue the following query:
SQLgt;SELECT COUNT(*), prod_category_id FROM products
GROUP BY prod_category_id
HAVING COUNT(*) = (SELECT MAX(COUNT(*)) FROM products);
What is the outcome?
-
It executes successfully and gives the correct output.
-
It executes successfully but does not give the correct output.
-
It generates an error because the subquery does not have a GROUP BY clause.
-
It generates an error because = is not valid and should be replaced by the IN operator.
Correct Answer: C
Question No.314
View the Exhibit and examine the structure of the PROMOTIONS table.
Which two SQL statements would execute successfully? (Choose two.)
-
UPDATE promotionsSET promo_cost = promo_cost 100 WHERE
TO_CHAR(promo_end_date,#39;yyyy#39;) gt; #39;2000#39;;
-
SELECT promo_begin_dateFROM promotions WHERE
TO_CHAR(promo_begin_date,#39;mon dd yy#39;)=#39;jul 01 98#39;;
-
UPDATE promotions
SET promo_cost = promo_cost 100
WHERE promo_end_date gt; TO_DATE(SUBSTR(#39;01-JAN-2000#39;, 8));
-
SELECT TO_CHAR(promo_begin_date,#39;dd/month#39;)FROM promotions
WHERE promo_begin_date IN (TO_DATE(#39;JUN 01 98#39;), TO_DATE(#39;JUL 01 98#39;));
Correct Answer: AB
Question No.315
You want to display the date for the first Monday of the next month and issue the following command:
SQLgt;SELECT TO_CHAR(NEXT_DAY(LAST_DAY(SYSDATE), #39;MON#39;), #39;dd quot;is the first Monday
for #39;fmmonth rrrr#39;) FROM DUAL; What is the outcome?
-
It executes successfully and returns the correct result.
-
It executes successfully but does not return the correct result.
-
It generates an error because TO_CHAR should be replaced with TO_DATE.
-
It generates an error because rrrr should be replaced by rr in the format string.
-
It generates an error because fm and double quotation marks should not be used in the format string.
Correct Answer: A
Explanation:
NEXT_DAY(date, #39;char#39;): Finds the date of the next specified day of the week (#39;char#39;) following date. The value of char may be a number representing a day or a character string.
LAST_DAY(date): Finds the date of the last day of the month that contains date The second innermost function is evaluated next. TO_CHAR(#39;28-OCT-2009#39;, #39;fmMonth#39;) converts the given date based on the Month format mask and returns the character string October. The fm modifier trims trailing blank spaces from the name of the month.
Question No.316
The PRODUCTS table has these columns: PRODUCT_ID NUMBER(4) PRODUCT_NAME VARCHAR2(45) PRICE NUMBER(8, 2)
Evaluate this SQL statement: SELECT *
FROM PRODUCTS
ORDER BY price, product_name; What is true about the SQL statement?
-
The results are not sorted.
-
The results are sorted numerically.
-
The results are sorted alphabetically.
-
The results are sorted numerically and then alphabetically.
Correct Answer: D
Explanation:
The result is sort by price which is numeric and follow by product_name which is alphabetically.
Incorrect answer:
-
the results are sorted
-
the results are sorted with alphabetically as well
-
the results are sorted with numerically as well
Refer: Introduction to Oracle9i: SQL, Oracle University Study Guide, 2-2
Question No.317
Examine the structure of the EMPLOYEES table:
You want to generate a report that contains the department IDs and last names of employees ordered by hire date in their respective departments. Employees from one department must appear in a single row. Which query will provide the required output?
-
SELECT department_id quot;Dept.quot;,LISTAGG (last_name, `;#39;) WITHIN GROUP (ORDER BY hire_date)quot; Employeesquot;FROM employeesGROUP BY department_idORDER BY department_id;
-
SELECT department_id quot;Dept.quot;,LISTAGG (last_name, `;#39;) WITHIN GROUP (ORDER BY hire_date)quot; Employeesquot;FROM employeesGROUP BY department_idORDER BY hire_date;
-
SELECT department_id quot;Dept.quot;,LISTAGG (last_name, `;#39;) WITHIN GROUP (ORDER BY hire_date)quot; Employeesquot;)FROM employeesGROUP BY department_idORDER BY hire_date;
-
SELECT department_id quot;Dept.quot;,LISTAGG (last_name, `;#39;) WITHIN GROUP ORDER BY (hire_date)quot; Employeesquot;)FROM employeesGROUP BY department_idORDER BY department_id;
Correct Answer: C
Question No.318
Which best describes an inline view?
-
a schema object
-
a sub query that can contain an ORDER BY clause
-
another name for a view that contains group functions
-
a sub query that is part of the FROM clause of another query
Correct Answer: D
Explanation:
A sub query that is part of the FROM clause of another query.
Incorrect answer:
-
is not a schema object
-
sub query can contain GROUP BY clause as well.
-
does not necessary contains group functions
Refer: Introduction to Oracle9i: SQL, Oracle University Study Guide, 11-21
Question No.319
Examine the following SQL commands:
Which statement is true regarding the execution of the above SQL commands?
-
Both commands execute successfully.
-
The first CREATE TABLE command generates an error because the NULL constraint is not valid.
-
The second CREATE TABLE command generates an error because the CHECK constraint is not valid.
-
The first CREATE TABLE command generates an error because CHECK and PRIMARY KEY constraints cannot be used for the same column.
-
The first CREATE TABLE command generates an error because the column PROD_ID cannot be used in the PRIMARY KEY and FOREIGN KEY constraints.
Correct Answer: B Explanation: Defining Constraints
The slide gives the syntax for defining constraints when creating a table. You can create constraints at either the column level or table level. Constraints defined at the column level are included when the column is defined. Table-level constraints are defined at the end of the table definition and must refer to the column or columns on which the constraint pertains in a set of parentheses. It is mainly the syntax that differentiates the two; otherwise, functionally, a columnlevel constraint is the same as a table-level constraint. NOT NULL constraints must be defined at the column level. Constraints that apply to more than one column must be defined at the table level.
Question No.320
Examine the SQL statement that creates ORDERS table:
CREATE TABLE orders (SER_NO NUMBER UNIQUE, ORDER_ID NUMBER, ORDER_DATE DATE NOT NULL, STATUS VARCHAR2(10) CHECK (status IN (#39;CREDIT#39;, #39;CASH#39;)), PROD_ID NUMBER REFERENCES PRODUCTS(PRODUCT_ID), ORD_TOTAL NUMBER, PRIMARY KEY
(order_id, order_date));
For which columns would an index be automatically created when you execute the above SQL statement? (Choose two.)
-
SER_NO
-
ORDER_ID
-
STATUS
-
PROD_ID
-
ORD_TOTAL
-
composite index on ORDER_ID and ORDER_DATE
Correct Answer: AF
Explanation:
Index exist for UNIQUE and PRIMARY KEY constraints
Incorrect answer:
-
ORDER_ID is neither UNIQUE nor PRIMARY KEY
-
STATUS is neither UNIQUE nor PRIMARY KEY
-
PROD_ID is neither UNIQUE nor PRIMARY KEY
-
ORD_TOTAL is neither UNIQUE nor PRIMARY KEY
Refer: Introduction to Oracle9i: SQL, Oracle University Study Guide, 10-15
Get Full Version of the Exam
1z0-061 Dumps
1z0-061 VCE and PDF