Top Banner
Which statement about group functions is true? Group functions ignore null values. The PAYMENT table contains these columns: PAYMENT_ID NUMBER(9) PK PAYMENT_DATE DATE CUSTOMER_ID NUMBER(9) Which SELECT statement could you use to display the number of times each customer payment was made between January 1, 2003 and June 30, 2003 ? SELECT customer_id, COUNT(payment_id) FROM payment WHERE payment_date BETWEEN '01-JAN-2003' AND '30-JUN-2003' GROUP BY customer_id; Evaluate this statement: SELECT department_id, AVG(salary) FROM employees WHERE job_id <> 69879 GROUP BY job_id, department_id HAVING AVG(salary) > 35000 ORDER BY department_id; Which clauses restricts the result? WHERE job_id <> 69879 HAVING AVG(salary) > 35000 What is the correct order of clauses in a SELECT statement? SELECT FROM WHERE GROUP BY HAVING ORDER BY The MANUFACTURER table contains these columns: MANUFACTURER_ID NUMBER MANUFACTURER_NAME VARCHAR2(30) TYPE VARCHAR2(25) LOCATION_ID NUMBER You need to display the number of unique types of manufacturers at each location. Which SELECT statement should you use? SELECT location_id, COUNT(DISTINCT type) FROM manufacturer GROUP BY location_id;
131
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Oracle Sem.2

Which statement about group functions is true?Group functions ignore null values.

The PAYMENT table contains these columns:PAYMENT_ID NUMBER(9) PKPAYMENT_DATE DATECUSTOMER_ID NUMBER(9)Which SELECT statement could you use to display the number of times each customer payment was made between January 1, 2003 and June 30, 2003 ?SELECT customer_id, COUNT(payment_id)FROM paymentWHERE payment_date BETWEEN '01-JAN-2003' AND '30-JUN-2003'GROUP BY customer_id;

Evaluate this statement:SELECT department_id, AVG(salary)FROM employeesWHERE job_id <> 69879GROUP BY job_id, department_idHAVING AVG(salary) > 35000ORDER BY department_id;Which clauses restricts the result?WHERE job_id <> 69879HAVING AVG(salary) > 35000

What is the correct order of clauses in a SELECT statement?                SELECT FROM WHERE GROUP BY HAVING ORDER BY

The MANUFACTURER table contains these columns:MANUFACTURER_ID NUMBERMANUFACTURER_NAME VARCHAR2(30)TYPE VARCHAR2(25)LOCATION_ID NUMBERYou need to display the number of unique types of manufacturers at each location. Which SELECT statement should you use?SELECT location_id, COUNT(DISTINCT type)FROM manufacturerGROUP BY location_id;

Evaluate this SELECT statement:SELECT COUNT(employee_id), department_idFROM employeesGROUP BY department_id;You only want to include employees who earn more than 15000.Which clause should you include in the SELECT statement?WHERE salary > 15000

Page 2: Oracle Sem.2

Evaluate this SELECT statement:SELECT SUM(salary), department_id, manager_idFROM employeesGROUP BY department_id, manager_id;Which SELECT clause allows you to restrict the rows returned, based on a group function?                   HAVING SUM(salary) > 100000 

Group functions can be nested to a depth of?Two

The EMPLOYEES table contains these columns:ID_NUMBER NUMBER Primary KeyNAME VARCHAR2 (30)DEPARTMENT_ID NUMBERSALARY NUMBER (7,2)HIRE_DATE DATEEvaluate this SQL statement:SELECT id_number, name, department_id, SUM(salary)FROM employeesWHERE salary > 25000GROUP BY department_id, id_number, nameORDER BY hire_date;Why will this statement cause an error?The HIRE_DATE column is NOT included in the GROUP BY clause.

To control the order of rows returned using SET operators, the ORDER BY clause is used ______ and is placed in the _____ SELECT statement of the query.    ONCE; LAST

When using SET operators the names of the columns must be identified in all of the SELECT statements used in the query. True or False?False

GROUPING SETS is another extension to the GROUP BY clause and is used to specify multiple groupings of data but provide a single result set. True or False?True

CUBE can be applied to all aggregate functions including AVG, SUM, MIN, MAX, and COUNT. True or False?True

You use ROLLUP to:produce subtotal values 

You use GROUPING function to:                   Identify the extra row values created by either a ROLLUP or CUBE operation

Page 3: Oracle Sem.2

Which statement is false?The WITH clause decreases performance.

The Oracle server performs a correlated subquery when the subquery references a column from a table referred to in the parent. True or False?True

Which answer is incorrect? The parent statement can be:An INSERT statement

The WITH clause enables a SELECT statement to define the subquery block at the start of the query, process the block just once, label the results, and then refer to the results multiple times. True or False?True

If a single-row subquery returns a null value and uses the equality comparison operator, what will the outer query return?No rows

Which comparison operator can only be used with a single-row subquery?<>

Which of the following is a valid reason why the query below will not execute successfully?SELECT employee_id, last_name, salaryFROM employeesWHERE department_id =(SELECT department_id FROM employees WHERE last_name like '%u%')Single rather than multiple value operator used.

Which operator can be used with a multiple-row subquery?IN

You need to display all the players whose salaries are greater than or equal to John Brown's salary. Which comparison operator should you use?>=

You need to create a report to display the names of products with a cost value greater than the average cost of all products. Which SELECT statement should you use?SELECT product_nameFROM productsWHERE cost > (SELECT AVG(cost)FROM product);

Page 4: Oracle Sem.2

The TEACHERS and CLASS_ASSIGNMENTS tables contain these columns:TEACHERSTEACHER_ID NUMBER(5) Primary KeyNAME VARCHAR2 (25)SUBJECT_ID NUMBER(5)

CLASS_ASSIGNMENTSCLASS_ID NUMBER (5) Primary KeyTEACHER_ID NUMBER (5)DATEMAX_CAPACITY NUMBER (3)

All MAX_CAPACITY values are greater than 10. Which two SQL statements correctly use subqueries?SELECT *FROM class_assignmentsWHERE max_capacity = (SELECT AVG(max_capacity) FROM class_assignments);

SELECT *FROM teachersWHERE teacher_id = (SELECT teacher_id FROM teachers WHERE class_id = 45963);

If you use the equality operator (=) with a subquery, how many values can the subquery return?Only 1

You need to remove a row from the EMPLOYEES table. Which statement would you use?DELETE with a WHERE clause

You need to update both the DEPARTMENT_ID and LOCATION_ID columns in the EMPLOYEES table using one UPDATE statement. Which clause should you include in the UPDATE statement to update multiple columns?   The SET clause

What keyword in an UPDATE statement speficies the columns you want to change?SET

Examine the structures of the PRODUCTS and SUPPLIERS tables:SUPPLIERSSUPPLIER_ID NUMBER NOT NULL, Primary KeySUPPLIER_NAME VARCHAR2 (25)ADDRESS VARCHAR2 (30)CITY VARCHAR2 (25)REGION VARCHAR2 (10)POSTAL_CODE VARCHAR2 (11)

PRODUCTSPRODUCT_ID NUMBER NOT NULL, Primary KeyPRODUCT_NAME VARCHAR2 (25)

Page 5: Oracle Sem.2

SUPPLIER_ID NUMBER Foreign key to SUPPLIER_ID of the SUPPLIERS tableCATEGORY_ID NUMBERQTY_PER_UNIT NUMBERUNIT_PRICE NUMBER (7,2)QTY_IN_STOCK NUMBERQTY_ON_ORDER NUMBERREORDER_LEVEL NUMBERYou want to delete any products supplied by the five suppliers located in Atlanta. Which script should you use?DELETE FROM productsWHERE supplier_id IN(SELECT supplier_id FROM suppliers WHERE UPPER(city) = 'ATLANTA');

One of the sales representatives, Janet Roper, has informed you that she was recently married, and she has requested that you update her name in the employee database. Her new last name is Cooper. Janet is the only person with the last name of Roper that is employed by the company. The EMPLOYEES table contains these columns and all data is stored in lowercase:EMPLOYEE_ID NUMBER(10) PRIMARY KEYLAST_NAME VARCHAR2(20)FIRST_NAME VARCHAR2(20)DEPARTMENT_ID VARCHAR2 (20)HIRE_DATE DATESALARY NUMBER(10)Which UPDATE statement will accomplish your objective?UPDATE employeesSET last_name = 'cooper'WHERE last_name = 'roper';

One of your employees was recently married. Her employee ID is still 189, however, her last name is now Rockefeller. Which SQL statement will allow you to reflect this change?UPDATE my_employees SET last_name = 'Rockefeller' WHERE employee_ID = 189;

Assume all the column names are correct. The following SQL statement will execute which of the following?INSERT INTO departments (department_id, department_name, manager_id, location_id)VALUES (70, 'Public Relations', 100, 1700);70 will be inserted into the department_id column

You need to display each employee's name in all uppercase letters. Which function should you use?UPPER

You query the database with this SQL statement:SELECT CONCAT(last_name, (SUBSTR(LOWER(first_name), 4))) "Default Password"FROM employees;Which function will be evaluated first?LOWER

Page 6: Oracle Sem.2

Which SQL function is used to return the position where a specific character string begins within a larger character string?INSTR

Which three statements about functions are true?The SYSDATE function returns the Oracle Server date and time.The ROUND number function rounds a value to a specified decimal place or the nearest whole number.The SUBSTR character function returns a portion of a string beginning at a defined character position to a specified length.

The PRICE table contains this data:PRODUCT_ID MANUFACTURER_ID86950 59604You query the database and return the value 95. Which script did you use?SELECT SUBSTR(product_id, 3, 2)FROM priceWHERE manufacturer_id = 59604;

You need to display the number of characters in each customer's last name. Which function should you use?LENGTH

You issue this SQL statement:SELECT INSTR ('organizational sales', 'al')FROM dual;Which value is returned by this command?13

You issue this SQL statement:SELECT ROUND (1282.248, -2)FROM dual;What value does this statement produce?1300

Evaluate this function: MOD (25, 2) Which value is returned?1

Which two functions can be used to manipulate number or date column values, but NOT character column values?TRUNCROUND

You need to display the current year as a character value (for example: Two Thousand and One). Which element would you use?YEAR

Which SELECT statement will NOT return a date value?SELECT (SYSDATE - hire_date) + 10*8FROM employees;

You need to display the number of months between today's date and each

Page 7: Oracle Sem.2

employee's hiredate. Which function should you use?MONTHS_BETWEEN 

You want to create a report that displays all orders and their amounts that were placed during the month of January. You want the orders with the highest amounts to appear first. Which query should you issue?SELECT orderid, totalFROM ordersWHERE order_date BETWEEN '01-jan-02' AND '31-jan-02'ORDER BY total DESC;

Evaluate this SELECT statement:SELECT SYSDATE + 30FROM dual;Which value is returned by the query?the current date plus 30 days

Which three statements concerning explicit data type conversions are true?Use the TO_DATE function to convert a character string to a date value.Use the TO_NUMBER function to convert a character string of digits to a number.Use the TO_CHAR function to convert a number or date value to character string.

The EMPLOYEES table contains these columns:EMPLOYEE_ID NUMBER(9)LAST_NAME VARCHAR2 (25)FIRST_NAME VARCHAR2 (25)SALARY NUMBER(6)You need to create a report to display the salaries of all employees. Which script should you use to display the salaries in format: "$45,000.00"?SELECT TO_CHAR(salary, '$999,999.00')FROM employees;

Which statement concerning single row functions is true?Single row functions can be nested.

Which SQL Statement should you use to display the prices in this format: "$00.30"?SELECT TO_CHAR(price, '$99,900.99') FROM product;

Which best describes the TO_CHAR function?The TO_CHAR function can be used to display dates and numbers according to formatting conventions that are supported by Oracle.

The EMPLOYEES table contains these columns:EMPLOYEE_ID NUMBER(9)LAST_NAME VARCHAR2 (25)FIRST_NAME VARCHAR2 (25)HIRE_DATE DATEYou need to display HIRE_DATE values in this format: January 28, 2000Which SELECT statement could you use?SELECT TO_CHAR(hire_date, 'Month DD, YYYY')

Page 8: Oracle Sem.2

FROM employees;

Which of the following General Functions will return the first non-null expression in the expression list?COALESCE

Which statement about group functions is true?NVL, NVL2, and COALESCE can be used with group functions to replace null values.

The STYLES table contains this data:STYLE_ID STYLE_NAME CATEGORY COST895840 SANDAL 85940 12.00968950 SANDAL 85909 10.00869506 SANDAL 89690 15.00809090 LOAFER 89098 10.00890890 LOAFER 89789 14.00857689 HEEL 85940 11.00758960 SANDAL 86979Evaluate this SELECT statement:SELECT style_id, style_name, category, costFROM stylesWHERE style_name = 'SANDAL' AND NVL(cost, 0) < 15.00 ORDER BY category, cost;Which result will the query provide?STYLE_ID STYLE_NAME CATEGORY COST 968950 SANDAL 85909 10.00 895840 SANDAL 85940 12.00 758960 SANDAL 86979

When joining 3 tables in a SELECT statement, how many join conditions are needed in the WHERE clause?2

You have the following EMPLOYEES table:EMPLOYEE_ID NUMBER(5) NOT NULL PRIMARY KEYFIRST_NAME VARCHAR2(25)LAST_NAME VARCHAR2(25)ADDRESS VARCHAR2(35)CITY VARCHAR2(25)STATE VARCHAR2(2)ZIP NUMBER(9)TELEPHONE NUMBER(10)DEPARTMENT_ID NUMBER(5) NOT NULL FOREIGN KEYThe BONUS table includes the following columns:BONUS_ID NUMBER(5) NOT NULL PRIMARY KEYANNUAL_SALARY NUMBER(10)BONUS_PCT NUMBER(3, 2)EMPLOYEE_ID VARCHAR2(5) NOT NULL FOREIGN KEYYou want to determine the amount of each employee's bonus, as a calculation of salary times bonus. Which of the following queries should you issue?SELECT e.first_name, e.last_name, b.annual_salary * b. bonus_pct FROM employees e, bonus b WHERE e.employee_id = b.employee_id;

Page 9: Oracle Sem.2

You have been asked to create a report that lists all corporate customers and all orders that they have placed. The customers should be listed alphabetically beginning with the letter 'A', and their corresponding order totals should be sorted from the highest amount to the lowest amount. Which of the following statements should you issue?SELECT c.custid, c.companyname, o.orderdate, o. custid, o.amount FROM customers c, orders o WHERE c.custid = o.custid ORDER BY companyname, amount DESC;

Evaluate this SQL statement:SELECT e.employee_id, e.last_name, e.first_name, d.department_nameFROM employees e, departments dWHERE e.department_id = d.department_id AND employees.department_id > 5000ORDER BY 4;Which clause contains a syntax error?AND employees.department_id > 5000 (*)

You need to create a report that lists all employees in department 10 (Sales) whose salary is not equal to $25,000 per year. Which query should you issue to accomplish this task?SELECT last_name, first_name, salaryFROM employeesWHERE salary != 25000 AND department_id = 10;

What happens when you create a Cartesian product?All rows from one table are joined to all rows of another table

Which statement about outer joins is true?The OR operator cannot be used to link outer join conditions.

The EMPLOYEE_ID column in the EMPLOYEES table corresponds to the EMPLOYEE_ID column of the ORDERS table. The EMPLOYEE_ID column in the ORDERS table contains null values for rows that you need to display. Which type of join should you use to display the data?outer join

Using Oracle Proprietary join syntax, which two operators can be used in an outer join condition using the outer join operator (+)?AND and =

Which statement about a natural join is true?Columns with the same names must have the same precision and datatype.

Which of the following best describes a natural join?A join between two tables that includes columns that share the same name, datatypes and lengths

The following SQL statement will produce what output?SELECT last_name, department_nameFROM employeesCROSS JOIN departments;A Cartesian product between the two tables.

Page 10: Oracle Sem.2

For which condition would you use an equijoin query with the USING keyword?You need to perform a join of the CUSTOMER and ORDER tables but limit the number of columns in the join condition.

Below find the structure of the CUSTOMERS and SALES_ORDER tables:CUSTOMERSCUSTOMER_ID NUMBER NOT NULL, Primary KeyCUSTOMER_NAME VARCHAR2 (30)CONTACT_NAME VARCHAR2 (30)CONTACT_TITLE VARCHAR2 (20)ADDRESS VARCHAR2 (30)CITY VARCHAR2 (25)REGION VARCHAR2 (10)POSTAL_CODE VARCHAR2 (20)COUNTRY_ID NUMBER Foreign key to COUNTRY_ID column of the COUNTRY tablePHONE VARCHAR2 (20)FAX VARCHAR2 (20)CREDIT_LIMIT NUMBER(7,2)

SALES_ORDERORDER_ID NUMBER NOT NULL, Primary KeyCUSTOMER_ID NUMBER Foreign key to CUSTOMER_ID column of the CUSTOMER tableORDER_DT DATEORDER_AMT NUMBER (7,2)SHIP_METHOD VARCHAR2 (5)You need to create a report that displays customers without a sales order. Which statement could you use?SELECT c.customer_nameFROM customers cWHERE c.customer_id not in (SELECT s.customer_id FROM sales_order s);

The primary advantage of using JOIN ON is:It permits columns with different names to be joined

Evaluate this SELECT statement:SELECT a.last_name || ', ' || a.first_name as "Patient", b.last_name || ', ' || b.first_name as "Physician", c.admissionFROM patient aJOIN physician bON (b.physician_id = c.physician_id)JOIN admission cON (a.patient_id = c.patient_id);Which clause generates an error?ON (b.physician_id = c.physician_id)

What should be included in a SELECT statement to return NULL values from all tables?full outer joins

Page 11: Oracle Sem.2

Which query will retrieve all the rows in the EMPLOYEES table, even if there is no match in the DEPARTMENTS table?SELECT e.last_name, e.department_id, d.department_nameFROM employees eLEFT OUTER JOIN departments d ON (e.department_id = d.department_id);

Which type of join returns rows from one table that have NO direct match in the other table?outer join

Evaluate this SELECT statement:SELECT MIN(hire_date), department_idFROM employeesGROUP BY department_id;Which values are displayed?The earliest hire date in each department.

Which statement about the GROUP BY clause is true?The first column listed in the GROUP BY clause is the most major grouping.

Evaluate this SELECT statement:SELECT MAX(salary), department_idFROM employeesGROUP BY department_id;Which values are displayed?The highest salary in each department.

What will the following SQL Statement do?SELECT job_id, COUNT(*)FROM employeesGROUP BY job_id;Displays each job id and the number of people assigned to that job id.

Which group function would you use to display the lowest value in the SALES_AMOUNT column?MIN

Group functions return a value for ________________ and ________________ null values in their computations.a row set, ignoreThe EMPLOYEES table contains these columns:

EMPLOYEE_ID NUMBER(9)LAST_NAME VARCHAR2(20)FIRST_NAME VARCHAR2(20)SALARY NUMBER(9,2)HIRE_DATE DATEBONUS NUMBER(7,2)COMM_PCT NUMBER(4,2)Which three functions could be used with the HIRE_DATE, LAST_NAME, or SALARY columns?MAXMINCOUNT

Page 12: Oracle Sem.2

Which group function would you use to display the total of all salary values in the EMPLOYEE table?SUM 

You need to calculate the standard deviation for the cost of products produced in the Birmingham facility. Which group function will you use? STDDEV

You need to calculate the average salary of employees in each department. Which group function will you use?AVG

You need to compute the total salary for all employees in department 10. Which group function will you use?SUM

Which aggregate function can be used on a column of the DATE data type?MAX

Evaluate this SQL statement:SELECT COUNT (amount)FROM inventory;What will occur when the statement is issued?The statement will count the number of rows in the INVENTORY table where the AMOUNT column is not null.

Which SELECT statement will calculate the number of rows in the PRODUCTS table?SELECT COUNT (*) FROM products;

The EMPLOYEES table contains these columns:EMPLOYEE_ID NUMBER(9)LAST_NAME VARCHAR2(20)FIRST_NAME VARCHAR2(20)SALARY NUMBER(7,2)DEPARTMENT_ID NUMBER(9)You need to display the number of employees whose salary is greater than $50,000? Which SELECT would you use?SELECT * FROM employeesWHERE salary < 50000; SELECT COUNT(*) FROM employees WHERE salary < 50000; SELECT COUNT(*) FROM employees WHERE salary > 50000;

Examine the data from the LINE_ITEM table:LINE_ITEM_ID ORDER_ID PRODUCT_ID PRICE DISCOUNT890898 847589 848399 8.99 0.10768385 862459 849869 5.60 0.05867950 985490 945809 5.60954039 439203 438925 5.25 0.15543949 349302 453235 4.50You query the LINE_ITEM table and a value of 3 is returned. Which SQL statement did you execute?SELECT COUNT(discount) FROM line_item;

Page 13: Oracle Sem.2

Evaluate this SELECT statement:SELECT COUNT(emp_id), mgr_id, dept_idFROM employeeWHERE status = 'I'GROUP BY dept_idHAVING salary > 30000ORDER BY 2;Why does this statement return a syntax error?MGR_ID must be included in the GROUP BY clause.

The PRODUCTS table contains these columns:PROD_ID NUMBER(4)PROD_NAME VARCHAR(20)PROD_CAT VARCHAR2(15)PROD_PRICE NUMBER(5)PROD_QTY NUMBER(4)You need to identify the minimum product price in each product category. Which statement could you use to accomplish this task?SELECT prod_cat, MIN (prod_price)FROM productsGROUP BY prod_cat;

You want to write a report that returns the average salary of all employees in the company, sorted by departments. The EMPLOYEES table contains the following columns:EMPLOYEES:EMPLOYEE_ID NUMBER(10) PRIMARY KEYLAST_NAME VARCHAR2(20)FIRST_NAME VARCHAR2(20)DEPARTMENT VARCHAR2(20)HIRE_DATE DATESALARY NUMBER(10)Which SELECT statement will return the information that you require?SELECT AVG (salary)FROM employeesGROUP BY department;

Evaluate this SELECT statement:SELECT SUM(salary), department_id, department_nameFROM employeesWHERE department_id = 1GROUP BY department;Which clause of the SELECT statement contains a syntax error?GROUP BY

The EMPLOYEES table contains the following columns:EMPLOYEE_ID NUMBER(10) PRIMARY KEYLAST_NAME VARCHAR2(20)FIRST_NAME VARCHAR2(20)DEPARTMENT VARCHAR2(20)HIRE_DATE DATESALARY NUMBER(10)

Page 14: Oracle Sem.2

You want to create a report that includes each employee's last name, employee identification number, date of hire and salary. The report should include only those employees who have been with the company for more than one year and whose salary exceeds $40,000. Which of the following SELECT statements will accomplish this task?SELECT employee_id, last_name, hire_date, salaryFROM employeesWHERE salary > 40000AND (sysdate-hire_date) / 365 > 1;

The PRODUCTS table contains these columns:PRODUCT_ID NUMBER(9) PKCATEGORY_ID VARCHAR2(10)LOCATION_ID NUMBER(9)DESCRIPTION VARCHAR2(30)COST NUMBER(7,2)PRICE NUMBER(7,2)QUANTITY NUMBERYou display the total of the extended costs for each product category by location. You need to include only the products that have a price less than $25.00. The extended cost of each item equals the quantity value multiplied by the cost value. Which SQL statement will display the desired result?SELECT category_id, SUM(cost * quantity) TOTAL, location_id FROM products WHERE price < 25.00 GROUP BY category_id, location_id;

Which statement about the GROUP BY clause is true? To exclude rows before dividing them into groups using the GROUP BY clause, you should use a WHERE clause.

The PLAYERS and TEAMS tables contain these columns: PLAYERS PLAYER_ID NUMBER NOT NULL, Primary Key LAST_NAME VARCHAR2 (30) NOT NULL FIRST_NAME VARCHAR2 (25) NOT NULL TEAM_ID NUMBER POSITION VARCHAR2 (25) TEAMS TEAM_ID NUMBER NOT NULL, Primary Key TEAM_NAME VARCHAR2 (25) You need to create a report that lists the names of each team with more than three goal keepers. Which SELECT statement will produce the desired result?SELECT t.team_name, COUNT(p.player_id)FROM players p JOIN teams t ON (p.team_id = t.team_id)WHERE UPPER(p.position) = 'GOAL KEEPER'GROUP BY t.team_name HAVING COUNT(p.player_id) > 3;

The EMPLOYEES and ORDERS tables contain these columns:EMPLOYEESEMPLOYEE_ID NUMBER(10) NOT NULL PRIMARY KEYFIRST_NAME VARCHAR2(30)LAST_NAME VARCHAR2(30)ADDRESS VARCHAR2(25)CITY VARCHAR2(20)STATE VARCHAR2(2)ZIP NUMBER(9)TELEPHONE NUMBER(10)

Page 15: Oracle Sem.2

ORDERSORDER_ID NUMBER(10) NOT NULL PRIMARY KEYEMPLOYEE_ID NUMBER(10) NOT NULL FOREIGN KEYORDER_DATE DATETOTAL NUMBER(10)Which SELECT statement will return all orders generated by a sales representative named Franklin during the year 2001?SELECT order_id, totalFROM ORDERSWHERE employee_id = (SELECT employee_id FROM employees WHERE last_name = 'Franklin')AND order_date BETWEEN '01-jan-01' AND '31-dec-01';

Using a subquery in which of the following clauses will return a syntax error?You can use subqueries in all of the above clauses. 

Which of the following is TRUE regarding the order of subquery execution?The subquery executes once before the main query

Which statement about subqueries is true?Subqueries are often used in a WHERE clause to return values for an unknown conditional value.

Which operator can be used with subqueries that return only one row? LIKE

Examine the structure of the EMPLOYEE, DEPARTMENT, and ORDERS tables.EMPLOYEEEMPLOYEE_ID NUMBER(9)LAST_NAME VARCHAR2(25)FIRST_NAME VARCHAR2(25)DEPARTMENT_ID NUMBER(9)

DEPARTMENTDEPARTMENT_ID NUMBER(9)DEPARTMENT_NAME VARCHAR2(25)CREATION_DATE DATE

ORDERSORDER_ID NUMBER(9)EMPLOYEE_ID NUMBER(9)DATE DATECUSTOMER_ID NUMBER(9)You want to display all employees who had an order after the Sales department was established. Which of the following constructs would you use?a single-row subquery

Examine the following EMPLOYEES table:EMPLOYEESEMPLOYEE_ID NUMBER(9)LAST_NAME VARCHAR2(25)FIRST_NAME VARCHAR2(25)DEPARTMENT_ID NUMBER(9)

Page 16: Oracle Sem.2

SUPERVISOR_ID NUMBER(9)You need to produce a report that contains all employee-related information for those employees who have Brad Carter as a supervisor. However, you are not sure which supervisor ID belongs to Brad Carter. Which query should you issue to accomplish this task?SELECT *FROM employeesWHERE supervisor_id =(SELECT employee_idFROM employeesWHERE last_name = 'Carter');

Which best describes a single-row subquery? a query that returns only one row from the inner SELECT statement

Which best describes a multiple-row subquery?A query that returns one or more rows from the inner SELECT statement

What is wrong with the following query?SELECT employee_id, last_nameFROM employeesWHERE salary =(SELECT MIN(salary) FROM employees GROUP BY department_id);Subquery returns more than one row and single row comparison operator is used.

Evaluate this SELECT statement:SELECT customer_id, nameFROM customerWHERE customer_id IN(SELECT customer_id FROM customer WHERE state_id = 'GA' AND credit_limit > 500.00);What would happen if the inner query returned null?No rows would be returned by the outer query.

Evaluate this SQL statement:SELECT employee_id, last_name, salaryFROM employeesWHERE department_id IN(SELECT department_idFROM employeesWHERE salary > 30000 AND salary < 50000); Which values will be displayed?All employees who work in a department with employees who earn more than $30,000, but less than $50,000.

Evaluate this SELECT statement: SELECT student_id, last_name, first_name FROM student WHERE major_id NOT IN (SELECT major_id  FROM majors  WHERE department_head_id = 30 AND title = 'ADJUNCT'); What would happen if the inner query returned a NULL value row? No rows would be returned from the STUDENT table.

Page 17: Oracle Sem.2

Which of the following statements contains a comparison operator that is used to restrict rows based on a list of values returned from an inner query?All of the above.

A multiple-row operator expects how many values?One or more

What would happen if you attempted to use a single-row operator with a multiple-row subquery?An error would be returned.

Which operator or keyword cannot be used with a multiple-row subquery? =

You need to display all the products that cost more than the maximum cost of every product produced in Japan. Which multiple-row comparison operator could you use? >ANY

Evaluate the structure of the EMPLOYEE and DEPART_HIST tables:EMPLOYEE:EMPLOYEE_ID NUMBER(9)LAST_NAME VARCHAR2(25)FIRST_NAME VARCHAR2(25)DEPARTMENT_ID NUMBER(9)MANAGER_ID NUMBER(9)SALARY NUMBER(7,2)

DEPART_HIST:EMPLOYEE_ID NUMBER(9)OLD_DEPT_ID NUMBER(9)NEW_DEPT_ID NUMBER(9)CHANGE_DATE DATEYou want to generate a list of employees who are in department 10, but used to be in department 15.Which query should you use?SELECT employee_id, last_name, first_name, department_idFROM employeeWHERE (employee_id, department_id) IN(SELECT employee_id, new_dept_id FROM depart_hist WHERE old_dept_id = 15) AND new_dept_id = 10;

The PRODUCTS table contains these columns:PRODUCT_ID NUMBER NOT NULLPRODUCT_NAME VARCHAR2 (25)SUPPLIER_ID NUMBER NOT NULLLIST_PRICE NUMBER (7,2)COST NUMBER (5,2)QTY_IN_STOCK NUMBER(4)LAST_ORDER_DT DATE NOT NULL DEFAULT SYSDATEWhich INSERT statement will execute successfully?

Page 18: Oracle Sem.2

INSERT INTO products VALUES (2958, 'Cable', 8690, 7.09, 4.04, 700);

The PRODUCTS table contains these columns:PROD_ID NUMBER(4)PROD_NAME VARCHAR2(25)PROD_PRICE NUMBER(3)You want to add the following row data to the PRODUCTS table:(1) a NULL value in the PROD_ID column(2) "6-foot nylon leash" in the PROD_NAME column(3) "10" in the PROD_PRICE columnYou issue this statement:INSERT INTO productsVALUES (null,'6-foot nylon leash', 10);What row data did you add to the table?The row was created with the correct data in all three columns.

You have been instructed to add a new customer to the CUSTOMERS table. Because the new customer has not had a credit check, you should not add an amount to the CREDIT column.The CUSTOMERS table contains these columns:CUST_ID NUMBER(10)COMPANY VARCHAR2(30)CREDIT NUMBER(10)POC VARCHAR2(30)LOCATION VARCHAR2(30)Which two INSERT statements will accomplish your objective?INSERT INTO customers (cust_id, company, poc, location)VALUES (200, 'InterCargo', 'tflanders', 'samerica');

INSERT INTO customersVALUES (200, 'InterCargo', null, 'tflanders', 'samerica');

Which statement about the VALUES clause of an INSERT statement is true?If no column list is specified, then the values must be in the order the columns are specified in the table.

You need to update the area code of employees that live in Atlanta . Evaluate this partial UPDATE statement:UPDATE employeeSET area_code = 770Which of the following should you include in your UPDATE statement to achieve the desired results?WHERE city = 'Atlanta';

What would happen if you issued a DELETE statement without a WHERE clause?All the rows in the table would be deleted.

You need to delete a record in the EMPLOYEES table for Tim Jones, whose unique employee identification number is 348. The EMPLOYEES table contains these columns:EMPLOYEE_ID NUMBER(5) PRIMARY KEYLAST_NAME VARCHAR2(20)

Page 19: Oracle Sem.2

FIRST_NAME VARCHAR2(20)ADDRESS VARCHAR2(30)PHONE NUMBER(10)Which DELETE statement will delete the appropriate record without deleting any additional records?DELETE FROM employees WHERE employee_id = 348;

Which two commands can be used to modify existing data in a database row?MERGEUPDATE

When the WHERE clause is missing in a DELETE statement, what is the result?All rows are deleted from the table.

Which of the following represents the correct syntax for an INSERT statement?INSERT INTO customers VALUES (3178, 'J.', 'Smith', '123 Main Street', 'Nashville', 'TN', '37777');

The EMPLOYEES table contains the following columns:EMPLOYEE_ID NUMBER(10) PRIMARY KEYLAST_NAME VARCHAR2(20)FIRST_NAME VARCHAR2(20)DEPARTMENT_ID NUMBER(10)HIRE_DATE DATESALARY NUMBER(9,2)BONUS NUMBER(9,2)You want to execute one DML statement to change the salary of all employees in department 10 to equal the new salary of employee id 89898. Currently, all employees in department 10 have the same salary value. Which statement should you execute?UPDATE employeesSET salary = (SELECT salary FROM employees WHERE employee_id = 89898)WHERE department_id = 10;

You want to enter a new record into the CUSTOMERS table. Which two commands can be used to create new rows?INSERT, MERGE

Examine the structures of the PLAYERS, MANAGERS, and TEAMS tables:PLAYERSPLAYER_ID NUMBER Primary KeyLAST_NAME VARCHAR2 (30)FIRST_NAME VARCHAR2 (25)TEAM_ID NUMBERMGR_ID NUMBERSIGNING_BONUS NUMBER(9,2)SALARY NUMBER(9,2)

MANAGERSMANAGER_ID NUMBER Primary KeyLAST_NAME VARCHAR2 (20)FIRST_NAME VARCHAR2 (20)TEAM_ID NUMBER

Page 20: Oracle Sem.2

TEAMSTEAM_ID NUMBER Primary KeyTEAM_NAME VARCHAR2 (20)OWNER_LAST_NAME VARCHAR2 (20)OWNER_FIRST_NAME VARCHAR2 (20)Which situation would require a subquery to return the desired result?To display the names of the managers for all the teams owned by a given owner 

Evaluate this statement: DELETE FROM customer; Which statement is true? The statement deletes all the rows from the CUSTOMER table.

PART II SEC. 5-7

31. The Oracle server performs a correlated subquery when the subquery references a column from a table referred to in the parent. True or False? Mark for Review

True (*)False

32. The WITH clause enables a SELECT statement to define the subquery block at the start of the query, process the block just once, label the results, and then refer to the results multiple times. True or False? Mark for Review

True (*)False

33. A correlated subquery will _______ a candidate row from an outer query, _______ the inner query using candidate row value, and _______ values from the inner query to qualify or disqualify the candidate row. Mark for Review (1) Points

CREATE; EXECUTE; USE

DELETE; UPDATE; INSERT

GET; EXECUTE; USE (*)

ROLLUP; GRANT; DROP

34. Oracle allows you to write named subqueries in one single statement, as long as you start your statement with the keyword WITH. True or False? Mark for Review

True (*)False

Page 21: Oracle Sem.2

35. Which statement about the <> operator is true? Mark for Review The <> operator is NOT a valid SQL operator.

The <> operator CANNOT be used in a single-row subquery.

The <> operator returns the same result as the ANY operator in a subquery.

The <> operator can be used when a single-row subquery returns only one row. (*)

36. Which best describes a single-row subquery? Mark for A query that returns only one row from the inner SELECT statement (*)

A query that returns one or more rows from the inner SELECT statement

A query that returns only one column value from the inner SELECT statement

A query that returns one or more column values from the inner SELECT statement

Section 7

37. You need to delete a record in the EMPLOYEES table for Tim Jones, whose unique employee identification number is 348. The EMPLOYEES table contains these columns:

EMPLOYEE_ID NUMBER(5) PRIMARY KEYLAST_NAME VARCHAR2(20)FIRST_NAME VARCHAR2(20)ADDRESS VARCHAR2(30)PHONE NUMBER(10)

Which DELETE statement will delete the appropriate record without deleting any additional records?

DELETE FROM employeesWHERE employee_id = 348;(*)

DELETE FROM employeesWHERE last_name = jones;

DELETE *FROM employeesWHERE employee_id = 348;

DELETE 'jones'FROM employees;

38. Examine the structures of the PRODUCTS and SUPPLIERS tables:

SUPPLIERSSUPPLIER_ID NUMBER NOT NULL, Primary KeySUPPLIER_NAME VARCHAR2 (25)ADDRESS VARCHAR2 (30)

Page 22: Oracle Sem.2

CITY VARCHAR2 (25)REGION VARCHAR2 (10)POSTAL_CODE VARCHAR2 (11)

PRODUCTSPRODUCT_ID NUMBER NOT NULL, Primary KeyPRODUCT_NAME VARCHAR2 (25)SUPPLIER_ID NUMBER Foreign key to SUPPLIER_ID of the SUPPLIERS tableCATEGORY_ID NUMBERQTY_PER_UNIT NUMBERUNIT_PRICE NUMBER (7,2)QTY_IN_STOCK NUMBERQTY_ON_ORDER NUMBERREORDER_LEVEL NUMBER

You want to delete any products supplied by the five suppliers located in Atlanta. Which script should you use?

DELETE FROM productsWHERE supplier_id IN(SELECT supplier_id FROM suppliers WHERE UPPER(city) = 'ATLANTA');(*)

DELETE FROM productsWHERE UPPER(city) = 'ATLANTA';

DELETE FROM productsWHERE supplier_id =(SELECT supplier_id FROM suppliers WHERE UPPER(city) = 'ATLANTA');

DELETE FROM suppliersWHERE supplier_id IN(SELECT supplier_id FROM suppliers WHERE UPPER(city) = 'ALANTA');

39. The EMPLOYEES table contains the following columns:

EMPLOYEE_ID NUMBER(10) PRIMARY KEYLAST_NAME VARCHAR2(20)FIRST_NAME VARCHAR2(20)DEPTARTMENT_ID VARCHAR2(20)HIRE_DATE DATESALARY NUMBER(9,2)BONUS NUMBER(9,2)

You need to increase the salary for all employees in department 10 by 10 percent. You also need to increase the bonus for all employees in department 10 by 15 percent. Which statement should you use?

UPDATE employeesSET salary = salary * 1.10, bonus = bonus * 1.15WHERE department_id = 10;(*)

Page 23: Oracle Sem.2

UPDATE employeesSET salary = salary * 1.10 AND bonus = bonus * 1.15WHERE department_id = 10;

UPDATE employeesSET (salary = salary * 1.10) SET (bonus = bonus * 1.15)WHERE department_id = 10;

UPDATE employeesSET salary = salary * .10, bonus = bonus * .15WHERE department_id = 10;

40. You need to update the expiration date of products manufactured before June 30th . In which clause of the UPDATE statement will you specify this condition? Mark

The ON clause

The WHERE clause (*)

The SET clause

The USING clause

41. You need to remove a row from the EMPLOYEES table. Which statement would you use?

UPDATE with a WHERE clause

INSERT with a WHERE clause

DELETE with a WHERE clause (*)

MERGE with a WHERE clause

42. The PLAYERS table contains these columns:

PLAYER_ID NUMBER NOT NULLPLAYER_LNAME VARCHAR2(20) NOT NULLPLAYER_FNAME VARCHAR2(10) NOT NULLTEAM_ID NUMBERSALARY NUMBER(9,2)

You need to increase the salary of each player for all players on the Tiger team by 12.5 percent. The TEAM_ID value for the Tiger team is 5960. Which statement should you use?

UPDATE players (salary)SET salary = salary * 1.125;

UPDATE playersSET salary = salary * .125WHERE team_id = 5960;

Page 24: Oracle Sem.2

UPDATE playersSET salary = salary * 1.125WHERE team_id = 5960;(*)

UPDATE players (salary)VALUES(salary * 1.125)WHERE team_id = 5960;

43. What would happen if you issued a DELETE statement without a WHERE clause? Mark for Review

All the rows in the table would be deleted. (*)

An error message would be returned.

No rows would be deleted.

Only one row would be deleted.

44. You need to update both the DEPARTMENT_ID and LOCATION_ID columns in the EMPLOYEES table using one UPDATE statement. Which clause should you include in the UPDATE statement to update multiple columns? Mark for Review

The USING clause

The ON clause

The WHERE clause

The SET clause (*)

45. You need to update the area code of employees that live in Atlanta. Evaluate this partial UPDATE statement:

UPDATE employeeSET area_code = 770

Which of the following should you include in your UPDATE statement to achieve the desired results?

UPDATE city = Atlanta;

SET city = 'Atlanta';

WHERE city = 'Atlanta'; (*)

LIKE 'At%';

46. Examine the structures of the PLAYERS, MANAGERS, and TEAMS tables:

PLAYERSPLAYER_ID NUMBER Primary KeyLAST_NAME VARCHAR2 (30)

Page 25: Oracle Sem.2

FIRST_NAME VARCHAR2 (25)TEAM_ID NUMBERMGR_ID NUMBERSIGNING_BONUS NUMBER(9,2)SALARY NUMBER(9,2)

MANAGERSMANAGER_ID NUMBER Primary KeyLAST_NAME VARCHAR2 (20)FIRST_NAME VARCHAR2 (20)TEAM_ID NUMBER

TEAMSTEAM_ID NUMBER Primary KeyTEAM_NAME VARCHAR2 (20)OWNER_LAST_NAME VARCHAR2 (20)OWNER_FIRST_NAME VARCHAR2 (20)

Which situation would require a subquery to return the desired result?To display the names each player on the Lions team

To display the maximum and minimum player salary for each team

To display the names of the managers for all the teams owned by a given owner (*)

To display each player, their manager, and their team name for all teams with a id value greater than 5000

47. You need to copy rows from the EMPLOYEE table to the EMPLOYEE_HIST table. What could you use in the INSERT statement to accomplish this task? Mark

An ON clause

A SET clause

A subquery (*)

A function

48. The STUDENTS table contains these columns:

STU_ID NUMBER(9) NOT NULLLAST_NAME VARCHAR2 (30) NOT NULLFIRST_NAME VARCHAR2 (25) NOT NULLDOB DATESTU_TYPE_ID VARCHAR2(1) NOT NULLENROLL_DATE DATE

You create another table, named FT_STUDENTS, with an identical structure.You want to insert all full-time students, who have a STU_TYPE_ID value of "F", into the new table. You execute this INSERT statement:

INSERT INTO ft_students

Page 26: Oracle Sem.2

(SELECT stu_id, last_name, first_name, dob, stu_type_id, enroll_dateFROM studentsWHERE UPPER(stu_type_id) = 'F');

What is the result of executing this INSERT statement?

All full-time students are inserted into the FT_STUDENTS table. (*)

An error occurs because the FT_STUDENTS table already exists.

An error occurs because you CANNOT use a subquery in an INSERT statement.

An error occurs because the INSERT statement does NOT contain a VALUES clause.

49. You need to add a row to an existing table. Which DML statement should you use? Mark for Review

UPDATE

INSERT (*)

DELETE

CREATE

50. The PRODUCTS table contains these columns:

PROD_ID NUMBER(4)PROD_NAME VARCHAR2(25)PROD_PRICE NUMBER(3)

You want to add the following row data to the PRODUCTS table:

(1) a NULL value in the PROD_ID column(2) "6-foot nylon leash" in the PROD_NAME column(3) "10" in the PROD_PRICE column

You issue this statement:

INSERT INTO productsVALUES (null,'6-foot nylon leash', 10);

What row data did you add to the table?

The row was created with the correct data in all three columns. (*)

The row was created with the correct data in two of three columns.

The row was created with the correct data in one of the three columns.

The row was created completely wrong. No data ended up in the correct columns.

Page 27: Oracle Sem.2

You need to display the current year as a character value (for example: Two Thousand and One). Which element would you use?

    

RR

YY

YYYY

YEAR (*)

You need to display the number of months between today's date and each employee's hiredate. Which function should you use?

             

ROUND

BETWEEN

ADD_MONTHS

MONTHS_BETWEEN (*)

             

Which SELECT statement will NOT return a date value?

             

SELECT (30 + hire_date) + 1440/24 

FROM employees;

SELECT (SYSDATE - hire_date) + 10*8 

FROM employees;

(*)

SELECT SYSDATE - TO_DATE('25-JUN-02') + hire_date 

FROM employees;

SELECT (hire_date - SYSDATE) + TO_DATE('25-JUN-02') 

FROM employees;

             

Page 28: Oracle Sem.2

You want to create a report that displays all orders and their amounts that were placed during the month of January. You want the orders with the highest amounts to appear first. Which query should you issue?

             

SELECT orderid, total 

FROM orders 

WHERE order_date LIKE '01-jan-02' AND '31-jan-02' 

ORDER BY total DESC;

SELECT orderid, total 

FROM orders 

WHERE order_date IN ( 01-jan-02 , 31-jan-02 ) 

ORDER BY total;

SELECT orderid, total 

FROM orders 

WHERE order_date BETWEEN '01-jan-02' AND '31-jan-02' 

ORDER BY total DESC;

(*)

SELECT orderid, total 

FROM orders 

WHERE order_date BETWEEN '31-jan-02' AND '01-jan-02' 

ORDER BY total DESC;

             

            Correct

Which function would you use to return the current database server date and time?

DATE

SYSDATE (*)

DATETIME

CURRENTDATE

Page 29: Oracle Sem.2

             

Section 2 Lesson 1

Which three statements concerning explicit data type conversions are true? (Choose three.)

Use the TO_NUMBER function to convert a number to a character string.

Use the TO_DATE function to convert a character string to a date value. (*)

Use the TO_NUMBER function to convert a character string of digits to a number. (*)

Use the TO_DATE function to convert a date value to character string or number.

Use the TO_CHAR function to convert a number or date value to character string. (*)

You have been asked to create a report that lists all customers who have placed orders of at least $2,500. The report's date should be displayed in the Day, Date Month, Year format (For example, Tuesday, 13 April, 2004 ). Which statement should you issue?

             

SELECT companyname, TO_CHAR (sysdate, 'fmdd, dy month, yyyy'), total 

FROM customers NATURAL JOIN orders 

WHERE total >= 2500;

SELECT companyname, TO_DATE (date, 'day, dd month, yyyy'), total 

FROM customers NATURAL JOIN orders 

WHERE total >= 2500;

SELECT companyname, TO_DATE (sysdate, 'dd, dy month, yyyy'), total 

FROM customers NATURAL JOIN orders 

WHERE total >= 2500;

SELECT companyname, TO_CHAR (sysdate, 'fmDay, dd Month, yyyy'), total 

FROM customers NATURAL JOIN orders 

WHERE total >= 2500;

(*)

             

            Incorrect. Refer to Section 2

Page 30: Oracle Sem.2

             

Which best describes the TO_CHAR function?

             

The TO_CHAR function can be used to specify meaningful column names in an SQL statement's result set.

The TO_CHAR function can be used to remove text from column data that will be returned by the database.

The TO_CHAR function can be used to display dates and numbers according to formatting conventions that are supported by Oracle. (*)

The TO_CHAR function can only be used on DATE columns.

             

Which statement concerning single row functions is true?

             

Single row functions can accept only one argument, but can return multiple values.

Single row functions cannot modify a data type.

Single row functions can be nested. (*)

Single row functions return one or more results per row.

             

Which functions allow you to perform explicit data type conversions?

             

ROUND, TRUNC, ADD_MONTHS

LENGTH, SUBSTR, LPAD, TRIM

TO_CHAR, TO_DATE, TO_NUMBER (*)

NVL, NVL2, NULLIF

 

The PRICE table contains this data:

PRODUCT_ID            MANUFACTURER_ID

86950 59604

Page 31: Oracle Sem.2

You query the database and return the value 95. Which script did you use?

SELECT SUBSTR(product_id, 3, 2)

FROM price

WHERE manufacturer_id = 59604;

(*)

 

SELECT LENGTH(product_id, 3, 2)

FROM price

WHERE manufacturer_id = 59604;

 

SELECT SUBSTR(product_id, -1, 3)

FROM price

WHERE manufacturer_id = 59604;

 

SELECT TRIM(product_id, -3, 2)

FROM price

WHERE manufacturer_id = 59604;

 

You query the database with this SQL statement:

SELECT CONCAT(last_name, (SUBSTR(LOWER(first_name), 4))) "Default Password"

FROM employees;

Which function will be evaluated first? 

CONCAT

SUBSTR

LOWER (*)

All three will be evaluated simultaneously.

Page 32: Oracle Sem.2

 

Which SQL function is used to return the position where a specific character string begins within a larger character string?

CONCAT

INSTR (*)

LENGTH

SUBSTR

Which functions can be used to manipulate character, number, and date column values?

CONCAT, RPAD, and TRIM (*)

UPPER, LOWER, and INITCAP

ROUND, TRUNC, and MOD

ROUND, TRUNC, and ADD_MONTHS

Incorrect. Refer to Section 1

 

Which three statements about functions are true? (Choose three.) (Choose all correct answers)

The SYSDATE function returns the Oracle Server date and time. (*)

The ROUND number function rounds a value to a specified decimal place or the nearest whole number. (*)

The CONCAT function can only be used on character strings, not on numbers.

The SUBSTR character function returns a portion of a string beginning at a defined character position to a specified length. (*)

 

Evaluate this SELECT statement:

SELECT LENGTH(email)

FROM employees;

What will this SELECT statement display?

 

Page 33: Oracle Sem.2

The longest e-mail address in the EMPLOYEES table.

The email address of each employee in the EMPLOYEES table.

The number of characters for each value in the EMAIL column in the EMPLOYEES table. (*)

The maximum number of characters allowed in the EMAIL column.

 

What will the following SQL statement display?

SELECT last_name, LPAD(salary, 15, '$')SALARY

FROM employees;

The last name of employees that have a salary that includes a $ in the value, size of 15 and the column labeled SALARY.

 

The last name and the format of the salary limited to 15 digits to the left of the decimal and the column labeled SALARY.

 

The last name and salary for all employees with the format of the salary 15 characters long, left-padded with the $ and the column labeled SALARY. (*)

 

The query will result in an error: "ORA-00923: FROM keyword not found where expected."

Section 1 Lesson 2

Evaluate this function: MOD (25, 2) Which value is returned?

1 (*)

2

25

0

 

You issue this SQL statement:

SELECT TRUNC(751.367,-1)

Page 34: Oracle Sem.2

FROM dual;

Which value does this statement display? 

700

750 (*)

751

751.3

Which two functions can be used to manipulate number or date column values, but NOT character column values? (Choose two.)

RPAD

TRUNC (*)

ROUND (*)

INSTR

CONCAT

 

What would happen if you issued a DELETE statement without a WHERE clause?

All the rows in the table would be deleted. (*)

An error message would be returned.

No rows would be deleted.

Only one row would be deleted.

Evaluate this statement: DELETE FROM customer; Which statement is true?

The statement deletes all the rows from the CUSTOMER table. (*)

The statement deletes the CUSTOMER column.

The statement deletes the first row in the CUSTOMERS table.

The statement removes the structure of the CUSTOMER table from the database

 

Examine the structures of the PRODUCTS and SUPPLIERS tables:

SUPPLIERS

Page 35: Oracle Sem.2

SUPPLIER_ID NUMBER NOT NULL, Primary Key

SUPPLIER_NAME VARCHAR2 (25)

ADDRESS VARCHAR2 (30)

CITY VARCHAR2 (25)

REGION VARCHAR2 (10)

POSTAL_CODE VARCHAR2 (11)

PRODUCTS

PRODUCT_ID NUMBER NOT NULL, Primary Key

PRODUCT_NAME VARCHAR2 (25)

SUPPLIER_ID NUMBER Foreign key to SUPPLIER_ID of the SUPPLIERS table

CATEGORY_ID NUMBER

QTY_PER_UNIT NUMBER

UNIT_PRICE NUMBER (7,2)

QTY_IN_STOCK NUMBER

QTY_ON_ORDER NUMBER

REORDER_LEVEL NUMBER

You want to delete any products supplied by the five suppliers located in Atlanta. Which script should you use?

 

DELETE FROM products

WHERE supplier_id IN

   (SELECT supplier_id

    FROM suppliers

    WHERE UPPER(city) = 'ATLANTA');

(*)

 

 

Page 36: Oracle Sem.2

DELETE FROM products

WHERE UPPER(city) = 'ATLANTA';

 

 

DELETE FROM products

WHERE supplier_id =

    (SELECT supplier_id

    FROM suppliers

    WHERE UPPER(city) = 'ATLANTA');

 

 

DELETE FROM products

WHERE supplier_id <

    (SELECT supplier_id

    FROM suppliers

    WHERE UPPER(city) = 'ALANTA');

Correct

 

What keyword in an UPDATE statement specifies the columns you want to change?

 

SELECT

WHERE

SET (*)

HAVING

You need to update the area code of employees that live in Atlanta . Evaluate this partial UPDATE statement:

Page 37: Oracle Sem.2

UPDATE employee

SET area_code = 770

Which of the following should you include in your UPDATE statement to achieve the desired results?

UPDATE city = Atlanta;

SET city = 'Atlanta';

WHERE city = 'Atlanta'; (*)

LIKE 'At%';

 

One of your employees was recently married. Her employee ID is still 189, however, her last name is now Rockefeller. Which SQL statement will allow you to reflect this change?

INSERT INTO my_employees SET last_name = 'Rockefeller' WHERE employee_ID = 189;

INSERT my_employees SET last_name = 'Rockefeller' WHERE employee_ID = 189;

UPDATE INTO my_employees SET last_name = 'Rockefeller' WHERE employee_ID = 189;

UPDATE my_employees SET last_name = 'Rockefeller' WHERE employee_ID = 189; (*)

 

When the WHERE clause is missing in a DELETE statement, what is the result?

All rows are deleted from the table. (*)

The table is removed from the database.

An error message is displayed indicating incorrect syntax.

Nothing. The statement will not execute.

You want to enter a new record into the CUSTOMERS table. Which two commands can be used to create new rows?

INSERT, CREATE

MERGE, CREATE

Page 38: Oracle Sem.2

INSERT, MERGE (*)

INSERT, UPDATE

The EMPLOYEES table contains the following columns:

EMPLOYEE_ID NUMBER(10) PRIMARY KEY

LAST_NAME VARCHAR2(20)

FIRST_NAME VARCHAR2(20)

DEPARTMENT_ID NUMBER(10)

HIRE_DATE DATE

SALARY NUMBER(9,2)

BONUS NUMBER(9,2)

You need to increase the salary for all employees in department 10 by 10 percent. You also need to increase the bonus for all employees in department 10 by 15 percent. Which statement should you use?

 

UPDATE employees

SET salary = salary * 1.10, bonus = bonus * 1.15

WHERE department_id = 10;

(*)

 

UPDATE employees

SET salary = salary * 1.10 AND bonus = bonus * 1.15

WHERE department_id = 10;

 

UPDATE employees

SET (salary = salary * 1.10) SET (bonus = bonus * 1.15)

WHERE department_id = 10;

Page 39: Oracle Sem.2

UPDATE employees

SET salary = salary * .10, bonus = bonus * .15

WHERE department_id = 10;

 

The EMPLOYEES table contains the following columns:

EMPLOYEE_ID NUMBER(10) PRIMARY KEY

LAST_NAME VARCHAR2(20)

FIRST_NAME VARCHAR2(20)

DEPARTMENT_ID NUMBER(10)

HIRE_DATE DATE

SALARY NUMBER(9,2)

BONUS NUMBER(9,2)

You want to execute one DML statement to change the salary of all employees in department 10 to equal the new salary of employee id 89898. Currently, all employees in department 10 have the same salary value. Which statement should you execute?

UPDATE employees

SET salary = SELECT salary

FROM employees

WHERE employee_id = 89898;

UPDATE employees

SET salary = (SELECT salary FROM employees WHERE employee_id = 89898);

UPDATE employees

SET salary = (SELECT salary FROM employees WHERE employee_id = 89898)

WHERE department_id = 10;

(*)

Page 40: Oracle Sem.2

UPDATE employees

SET salary = (SELECT salary FROM employees WHERE employee_id = 89898 AND department_id = 10);

You need to compute the total salary for all employees in department 10. Which group function will you use?

MAX

SUM (*)

VARIANCE

COUNT

The AVG, SUM, VARIANCE, and STDDEV functions can be used with which of the following?

Only numeric data types (*)

Integers only

Any data type

All except numeric

Which group function would you use to display the lowest value in the SALES_AMOUNT column?

AVG

COUNT

MAX

MIN (*)

 

Which group functions below act on character, number and date data types?

(Choose three)

SUM

MAX (*)

MIN (*)

AVG

COUNT (*)

Page 41: Oracle Sem.2

Which aggregate function can be used on a column of the DATE data type?

AVG

MAX (*)

STDDEV

SUM

 

Section 5 Lesson 3

Evaluate this SQL statement:

SELECT COUNT (amount)

FROM inventory;

What will occur when the statement is issued?

The statement will return the greatest value in the INVENTORY table.

The statement will return the total number of rows in the AMOUNT column.

The statement will replace all NULL values that exist in the AMOUNT column.

The statement will count the number of rows in the INVENTORY table where the AMOUNT column is not null. (*)

 

Evaluate this SELECT statement:

SELECT COUNT(*)

FROM employees

WHERE salary > 30000;

Which results will the query display?

The number of employees that have a salary less than 30000

The total of the SALARY column for all employees that have a salary greater than 30000.

The number of rows in the EMPLOYEES table that have a salary greater than 30000. (*)

The query generates an error and returns no results.

 

Page 42: Oracle Sem.2

The EMPLOYEES table contains these columns:

EMPLOYEE_ID NUMBER(9)

LAST_NAME VARCHAR2(20)

FIRST_NAME VARCHAR2(20)

SALARY NUMBER(7,2)

DEPARTMENT_ID NUMBER(9)

You need to display the number of employees whose salary is greater than $50,000? Which SELECT would you use?

 

SELECT * FROM employees

WHERE salary > 50000;

 

SELECT * FROM employees

WHERE salary < 50000;

 

SELECT COUNT(*) FROM employees

WHERE salary < 50000;

 

SELECT COUNT(*) FROM employees

WHERE salary > 50000;

(*)

 

 

Page 43: Oracle Sem.2

SELECT COUNT(*) FROM employees

WHERE salary > 50000

GROUP BY employee_id, last_name, first_name, salary, department_id;

 

 

Evaluate this SELECT statement:

SELECT COUNT(*)

FROM products;

Which statement is true?

The number of rows in the table is displayed. (*)

The number of unique PRODUCT_IDs in the table is displayed.

An error occurs due to an error in the SELECT clause.

An error occurs because no WHERE clause is included in the SELECT statement.

Section 6 Lesson 1

The PLAYERS table contains these columns:

PLAYER_ID NUMBER PK

PLAYER_NAME VARCHAR2 (30)

TEAM_ID NUMBER

HIRE_DATE DATE

SALARY NUMBER (8,2)

Which two clauses represent valid uses of aggregate functions? (Choose three.)

ORDER BY AVG(salary) (*)

GROUP BY MAX(salary)

SELECT AVG(NVL(salary, 0)) (*)

HAVING MAX(salary) > 10000 (*)

WHERE hire_date > AVG(hire_date)

 

Page 44: Oracle Sem.2

1. When a user session changes the value of a package variable, the new value can immediately be seen by other sessions. True or False? Mark for Review (1) Points

True

False (*)

Correct

2. A cursor is declared in a package specification. User SIOBHAN opens the cursor and fetches the first three rows from the cursor's active set, but does not close the cursor. User FRED now connects to the database. FRED can immediately fetch the next three rows without opening the cursor. True or False? Mark for Review (1) Points

True

False (*)

Correct

3. The UTL_FILE package can be used to create binary files such as JPEGs as well as text files. True or False? Mark for Review (1) Points

True

False (*)

Incorrect. Refer to Section 9.

4. An Oracle directory called FILESDIR has been created by executing: CREATE OR REPLACE DIRECTORY filesdir AS 'C:\NEWFILES'; Which of the following will create a new text file called C:\NEWFILES\EMP_REPORT.TXT ? Mark for Review (1) Points

UTL_FILE.CREATE('FILESDIR','EMP_REPORT.TXT');

UTL_FILE.FOPEN('C:\NEWFILES\EMP_REPORT.TXT','w');

Page 45: Oracle Sem.2

UTL_FILE.FOPEN('FILESDIR','EMP_REPORT.TXT','w'); (*)

UTL_FILE.OPEN('FILESDIR','EMP_REPORT.TXT','c');

Correct

5. What will be displayed when the following code is executed?

BEGIN DBMS_OUTPUT.PUT('I do like'); DBMS_OUTPUT.PUT_LINE('to be'); DBMS_OUTPUT.PUT('beside the seaside'); END; Mark for Review (1) Points

I do like to be beside the seaside

I do like to be beside the seaside

I do like to be

I do liketo be

(*)

I do like to be beside the seaside

Correct

6. Why is it better to use DBMS_OUTPUT only in anonymous blocks, not inside stored subprograms such as procedures? Mark for Review (1) Points

Because DBMS_OUTPUT cannot be used inside procedures

Because anonymous blocks display messages while the block is executing, while procedures do not display anything until their execution has finished

Page 46: Oracle Sem.2

Because DBMS_OUTPUT should be used only for testing and debugging PL/SQL code (*)

Because DBMS_OUTPUT can raise a NO_DATA_FOUND exception if used inside a packaged procedure

Incorrect. Refer to Section 9.

7. The easiest way to include DDL statements in a PL/SQL block is to use the DBMS_SQL package. True or False? Mark for Review (1) Points

True

False (*)

Incorrect. Refer to Section 9.

8. MARY wants HENRY to be able to query her EMPLOYEES table. Mary executes the following code:

DECLARE v_grant_stmt VARCHAR2(50); BEGIN v_grant_stmt := 'GRANT SELECT ON employees TO henry'; DBMS_SQL.EXECUTE(v_grant_stmt); END;

Mary has successfully granted the privilege to Henry. True or False? Mark for Review (1) Points

True

False (*)

Incorrect. Refer to Section 9.

9. Which of the following SQL statements can be included in a PL/SQL block only by using Dynamic SQL? (Choose two.) Mark for Review (1) Points

(Choose all correct answers)

DELETE

SAVEPOINT

Page 47: Oracle Sem.2

ALTER (*)

SELECT ..... FOR UPDATE NOWAIT

GRANT (*)

Correct

10. A SQL statement can pass through several stages. Which of the following is NOT one of these stages? Mark for Review (1) Points

BIND

FETCH

PARSE

RETURN (*)

EXECUTE

Incorrect. Refer to Section 9.

11. Which of the following are good reasons for creating and using Packages?

Related procedures, functions and variables can be grouped together as a single unit We can recompile the package body without having to recompile the specification We can create packages without needing any system privileges We can declare INDEX BY tables and use them as parameters Mark for Review (1) Points

A and B

A, B and C

A and C

A, B and D (*)

A, B, C and D

Incorrect. Refer to Section 9.

12. The following package specification has been created:

CREATE OR REPLACE PACKAGE mypack IS

Page 48: Oracle Sem.2

FUNCTION myfunc(p_funcparam DATE) RETURN BOOLEAN; PROCEDURE myproc(p_procparam IN NUMBER); END mypack;

Which of the following will correctly invoke the package subprograms? (Choose two.) Mark for Review

(1) Points

(Choose all correct answers)

mypack.myfunc('22-JAN-07');

mypack.myproc(35);

(*)

IF NOT mypack.myfunc(SYSDATE) THEN DBMS_OUTPUT.PUT_LINE('Message'); END IF;

(*)

myproc(40);

v_num := mypack.myproc(22);

Correct

13. Which one of the following can NOT be part of a Package ? Mark for Review

(1) Points

Procedures

Explicit cursors

Triggers (*)

Functions

Global variables

Correct

14. What is wrong with the following syntax for creating a package specification?

Page 49: Oracle Sem.2

CREATE OR REPLACE PACKAGE mypack IS g_constant1 NUMBER(6) := 100; FUNCTION func1 (p_param1 IN VARCHAR2); FUNCTION func2; END mypack; Mark for Review (1) Points

You cannot declare constants in the specification.

A package must contain at least one procedure.

The RETURN datatype of the functions must be specified.

(*)

The first line should be: CREATE OR REPLACE PACKAGE SPECIFICATION mypack IS

Nothing is wrong, this code contains no errors.

Incorrect. Refer to Section 9.

15. Which of the following statements about a package initialization block is true? Mark for Review (1) Points

It cannot contain any SQL statements.

It is an anonymous block at the end of a package body. (*)

It is a procedure in a package that must be invoked before the rest of the package can be used.

It is an anonymous block in the package specification.

It is executed automatically every time any global variable in the package is referenced.

Incorrect. Refer to Section 9.

Page 50: Oracle Sem.2

16. Package TAXPACK declares a global variable G_TAXRATE NUMBER(2,2). The value of the tax rate is stored in table TAXTAB in the database. You want to read this value automatically into G_TAXRATE each time a user session makes its first call to TAXPACK. How would you do this? Mark for Review (1) Points

Declare the global variable as: g_taxrate NUMBER(2,2) := SELECT tax_rate FROM taxtab;

Create a database trigger that includes the following code: SELECT tax_rate INTO taxpack.g_taxrate FROM taxtab;

Add a private function to the package body of TAXPACK, and invoke the function from the user session.

Add a package initialization block to the package body of TAXPACK.

(*)

Correct

17. Package HRPACK contains the following public function:

FUNCTION empfunc (p_deptno NUMBER) RETURN NUMBER IS BEGIN UPDATE employees SET salary = salary * 1.1 WHERE department_id = p_deptno; RETURN SQL%ROWCOUNT; END empfunc;

What will happen when the following SQL statement is executed?

SELECT department_name, hrpack.empfunc(department_id) FROM departments; Mark for Review (1) Points

The SELECT will fail because you cannot return SQL%ROWCOUNT from a packaged function.

The SELECT will fail because you cannot call packaged functions from within a SQL statement.

The SELECT will fail because you cannot execute a DML statement from within a query.

Page 51: Oracle Sem.2

The SELECT will succeed because it is referencing a different table from the function. (*)

Incorrect. Refer to Section 9.

18. Examine the following code:

CREATE OR REPLACE PACKAGE emppack IS PROCEDURE upd_emp (p_empno IN NUMBER, p_salary IN NUMBER); END emppack; CREATE OR REPLACE PACKAGE BODY emppack IS -- Line A PROCEDURE upd_emp (p_empno IN NUMBER, p_salary IN NUMBER) IS BEGIN IF NOT sal_ok(p_salary) THEN RAISE_APPLICATION_ERROR(-20201,'Invalid salary'); END IF; END upd_emp; FUNCTION sal_ok(pf_salary NUMBER) RETURN BOOLEAN IS BEGIN IF pf_salary > 50000 THEN RETURN FALSE; ELSE RETURN TRUE; END IF; END sal_ok; END emppack;

What must be coded at Line A for this package to compile successfully? Mark for Review (1) Points

FUNCTION sal_ok;

FUNCTION sal_ok(pf_salary NUMBER);

FUNCTION sal_ok(pf_salary NUMBER) RETURN BOOLEAN; (*)

PROCEDURE upd_emp (p_empno IN NUMBER, p_salary IN NUMBER);

Nothing is needed at Line A

Correct

19. A package contains both public and private subprograms. Which one of the following statements is true? Mark for Review (1) Points

Page 52: Oracle Sem.2

Each subprogram is loaded into memory when it is first invoked.

The public subprograms are all loaded into memory at the same time, but the private subprograms are loaded into memory one at a time as they are invoked.

The whole package is loaded into memory when the first call is made to any subprogram in the package. (*)

If three users invoke three different subprograms in the package, there will be three copies of the code in memory.

Incorrect. Refer to Section 9.

20. In a package, public components are declared in the specification but private components are not. True or False? Mark for Review (1) Points

True (*)

False

Correct

21. Package OLDPACK is in your schema. What will happen when the following statement is executed?

DROP PACKAGE oldpack; Mark for Review (1) Points

The body will be dropped but the specification will be retained.

The specification will be dropped but the body will be retained.

Both the specification and the body will be dropped. (*)

The statement will fail because you must drop the body before you can drop the specification.

Correct

22. When a change is made to the detailed code of a public procedure in a package (but not to the procedure's name or parameters), both the specification and the body must be recompiled. True or False? Mark for Review

Page 53: Oracle Sem.2

(1) Points

True

False (*)

Correct

23. Your schema contains four packages, each having a specification and a body. You have also been granted privileges to access three packages (and their bodies) in other users' schemas. What will be displayed by the following query?

SELECT COUNT(*) FROM ALL_OBJECTS WHERE object_type LIKE 'PACK%' AND owner <> USER; Mark for Review (1) Points

14

7

3

6 (*)

0

Incorrect. Refer to Section 9.

24. Package NEWPACK contains several procedures and functions, including private function PRIVFUNC. From where can PRIVFUNC be invoked? (Choose two.) Mark for Review (1) Points

(Choose all correct answers)

From an anonymous block

From any procedure in NEWPACK (*)

From any private function in another package

From any function in NEWPACK (*)

From any public procedure in another package

Correct

Page 54: Oracle Sem.2

25. We want to remove the specification (but not the body) of package BIGPACK from the database. Which of the following commands will do this? Mark for Review (1) Points

DROP PACKAGE bigpack;

DROP PACKAGE SPECIFICATION bigpack;

DROP PACKAGE bigpack SPECIFICATION;

DROP PACKAGE HEADER bigpack;

None of the above (*)

Incorrect. Refer to Section 9.

Section 10

26. Examine the following trigger. It should raise an application error if a user tries to update an employee's last name. It should allow updates to all other columns of the EMPLOYEES table. What should be coded at line A?

CREATE TRIGGER stop_ln_trigg BEFORE UPDATE ON employees BEGIN -- Line A RAISE_APPLICATION_ERROR(-20201,'Updating last name not allowed'); END IF; END; Mark for Review (1) Points

IF UPDATING LAST_NAME THEN

IF UPDATING('LAST_NAME') THEN (*)

IF UPDATE('LAST_NAME') THEN

IF UPDATING THEN

Incorrect. Refer to Section 10.

27. In the following code:

CREATE TRIGGER mytrigg INSTEAD OF INSERT OR UPDATE ON my_object_name

Page 55: Oracle Sem.2

FOR EACH ROW BEGIN ... my_object_name can be the name of a table. True or False? Mark for Review (1) Points

True

False (*)

Incorrect. Refer to Section 10.

28. There are 3 employees in department 90 and 5 employees in department 50. The following trigger has been created:

CREATE TRIGGER upd_emp_trigg AFTER UPDATE ON employees FOR EACH ROW BEGIN ...

A user now executes:

UPDATE employees SET department_id = 50 WHERE department_id = 90;

How many times will the trigger fire? Mark for Review (1) Points

Once

Three times (*)

Four times

Five times

Eight times

Incorrect. Refer to Section 10.

29. Examine the following code. To create a row trigger, what code should be included at Line A?

CREATE TRIGGER dept_trigg AFTER UPDATE OR DELETE ON departments -- Line A BEGIN ... Mark for Review (1) Points

Page 56: Oracle Sem.2

AFTER EACH ROW

FOR EVERY ROW

FOR EACH ROW (*)

ON EACH ROW

ON EVERY ROW

Correct

30. A trigger can be created in the database or within an application. True or False? Mark for Review (1) Points

True (*)

False

Correct

31. A trigger can be a public subprogram within a PL/SQL package. True or False? Mark for Review

(1) Points

True

False (*)

Incorrect. Refer to Section 10.

32. Which of the following are NOT stored inside the database? (Choose two.) Mark for Review (1) Points

(Choose all correct answers)

A PL/SQL package specification

A database trigger

An anonymous block (*)

An application trigger (*)

A sequence

Page 57: Oracle Sem.2

Correct

33. A business rule states that an employee's salary cannot be greater than 99,999.99 or less than 0. The best way to enforce this rule is by using: Mark for Review (1) Points

A datatype of NUMBER(7,2) for the SALARY column

A database trigger

A check constraint (*)

An application trigger

A view

Correct

34. Which of the following are good guidelines to follow when creating a database trigger? (Choose two.) Mark for Review (1) Points

(Choose all correct answers)

Where possible, use a trigger to enforce a foreign key constraint.

Use triggers to override privilege checking and view other users' private tables.

Do not use a trigger to replace or duplicate something which the Oracle Server does automatically. (*)

Use triggers to prevent unauthorized users from SELECTing confidential data.

Do not create a trigger that automatically fires another trigger. (*)

Correct

35. You can code COMMIT and ROLLBACK statements in a trigger body. True or False? Mark for Review (1) Points

Page 58: Oracle Sem.2

True

False (*)

Incorrect. Refer to Section 10.

36. What type of database object would you create to write an auditing record automatically every time a user connects to the database? Mark for Review (1) Points

A procedure

A complex view

A trigger (*)

A function

A package

Correct

37. A DML statement trigger fires only once for each triggering DML statement, while a row trigger fires once for each row processed by the triggering statement. True or False? Mark for Review (1) Points

True (*)

False

Correct

38. What is wrong with the following code?

CREATE OR REPLACE TRIGGER emp_dept_trigg BEFORE UPDATE OR DELETE ON employees, departments BEGIN ... Mark for Review (1) Points

One trigger can be associated with only one table

(*)

The second line should be: BEFORE (UPDATE,DELETE) ON employees, departments

Page 59: Oracle Sem.2

DML triggers must be row triggers, so FOR EACH ROW is missing

The second line should be: BEFORE UPDATE OR DELETE ON employees OR departments

Incorrect. Refer to Section 10.

39. What is wrong with the following code?

CREATE TRIGGER dept_trigg BEFORE UPDATE OF department_name ON departments BEGIN DBMS_OUTPUT.PUT_LINE(:NEW.department_name); END; Mark for Review (1) Points

You cannot use :NEW in a BEFORE trigger, only in an AFTER trigger.

You cannot use :NEW or :OLD in a statement trigger. (*)

You cannot use DBMS_OUTPUT.PUT_LINE inside a trigger.

The second line should be: BEFORE UPDATE ON departments.department_name

Correct

40. What is wrong with the following code?

CREATE OR REPLACE TRIGGER loc_trigg BEFORE DELETE ON locations BEGIN RAISE_APPLICATION_ERROR(-20201,'Invalid delete'); ROLLBACK; END; Mark for Review (1) Points

The last line should be: END loc_trigg;

Page 60: Oracle Sem.2

You cannot use RAISE_APPLICATION_ERROR inside a trigger.

The second line should be: BEFORE DELETE OF locations

You cannot use ROLLBACK inside a trigger.

(*)

Nothing is wrong, this trigger will compile and execute successfully.

Incorrect. Refer to Section 10.

41. You need to disable all triggers that are associated with DML statements on the DEPARTMENTS table. Which of the following commands should you use? Mark for Review (1) Points

ALTER TABLE departments DISABLE ALL TRIGGERS; (*)

ALTER TRIGGER DISABLE ALL ON departments;

ALTER TABLE departments DISABLE TRIGGERS;

DISABLE ALL TRIGGERS ON departments;

ALTER TABLE departments DROP ALL TRIGGERS;

Correct

42. Which dictionary view shows the detailed code of a trigger body? Mark for Review

(1) Points

USER_SOURCE

USER_TRIGGERS (*)

USER_OBJECTS

Page 61: Oracle Sem.2

USER_DML_TRIGGERS

USER_SUBPROGRAMS

Correct

43. User AYSEGUL successfully creates the following trigger:

CREATE TRIGGER loc_trigg BEFORE UPDATE ON aysegul.locations BEGIN ....

AYSEGUL now tries to drop the LOCATIONS table. What happens? Mark for Review (1) Points

An error message is displayed because you cannot drop a table that is associated with a trigger.

The table is dropped and the trigger is disabled.

The trigger is dropped but the table is not dropped.

Both the table and the trigger are dropped. (*)

None of the above.

Correct

44. Examine this code:

CREATE TRIGGER de_trigg -- Line A BEGIN ...

Which of the following are NOT valid at Line A ? (Choose two.) Mark for Review (1) Points

(Choose all correct answers)

AFTER LOGOFF ON SCHEMA (*)

AFTER LOGON ON SCHEMA

BEFORE LOGOFF ON SCHEMA

BEFORE DISCONNECT ON SCHEMA (*)

AFTER SERVERERROR ON SCHEMA

Page 62: Oracle Sem.2

Correct

45. Which kinds of trigger can cause a mutating table problem? (Choose two.) Mark for Review (1) Points

(Choose all correct answers)

BEFORE UPDATE row triggers (*)

DDL triggers

AFTER DELETE row triggers (*)

Database Event triggers

INSTEAD OF triggers

Correct

46. What is the purpose of using the CALL statement in a trigger? Mark for Review

(1) Points

It allows an INSTEAD OF trigger to be a statement trigger.

It allows the trigger body code to be placed in a separate procedure. (*)

It prevents cascading triggers.

It allows the trigger body code to be placed in a separate procedure or function.

It allows both DML events and DDL events to be handled using a single trigger.

Incorrect. Refer to Section 10.

47. Which of the following statements could cause a DDL trigger to fire? Mark for Review (1) Points

DROP TABLE employees;

Page 63: Oracle Sem.2

ALTER TABLE departments ADD (budget NUMBER(8,2));

CREATE TABLE newemp AS SELECT * FROM employees;

TRUNCATE TABLE locations;

All of the above (*)

Correct

48. A trigger automatically inserts a row into a logging table every time a user's session receives this error message: ORA-00942: table or view does not exist What kind of trigger is this? Mark for Review (1) Points

A row trigger

A statement trigger

A database event trigger (*)

A DDL trigger

An AFTER trigger

Correct

49. Examine the following code:

CREATE TRIGGER emp_trigg AFTER UPDATE OF salary ON employees FOR EACH ROW DECLARE v_count NUMBER; BEGIN -- Line A END;

Which of the following statements is NOT allowed at Line A? Mark for Review (1) Points

SELECT count(*) INTO v_count FROM departments;

UPDATE employees SET job_id = 'IT_PROG' WHERE employee_id = :OLD.employee_id;

Page 64: Oracle Sem.2

SELECT count(*) INTO v_count FROM employees; (*)

DBMS_OUTPUT.PUT_LINE('A salary was updated');

None. All of the above are allowed.

Incorrect. Refer to Section 10.

50. Examine this code:

CREATE TRIGGER new_trigg AFTER CREATE ON reserved_word BEGIN ...

Which of the following can be used in place of reserved_word? (Choose two.) Mark for Review (1) Points

(Choose all correct answers)

TABLE

SCHEMA (*)

USER

DATABASE (*)

TABLE employees

1. In a package, public components are declared in the specification but private components are not. True or False? Mark for Review (1) Points

True (*)

False

Correct

2. Which of the following will display the detailed code of the subprograms in package DEPTPACK in your schema ? Mark for Review (1) Points

Page 65: Oracle Sem.2

SELECT text FROM USER_SOURCE WHERE name = 'DEPTPACK' AND type = 'PACKAGE' ORDER BY line;

SELECT text FROM USER_SOURCE WHERE name = 'DEPTPACK' AND type = 'PACKAGE BODY' ORDER BY line;

(*)

SELECT text FROM USER_SOURCE WHERE object_name = 'DEPTPACK' AND object_type = 'PACKAGE BODY' ORDER BY line;

SELECT text FROM USER_SOURCEWHERE name = 'DEPTPACK' AND type = 'BODY' ORDER BY line;

Incorrect. Refer to Section 9.

3. Package OLDPACK is in your schema. What will happen when the following statement is executed?

DROP PACKAGE oldpack; Mark for Review (1) Points

The body will be dropped but the specification will be retained.

The specification will be dropped but the body will be retained.

Both the specification and the body will be dropped. (*)

The statement will fail because you must drop the body before you can drop the specification.

Correct

Page 66: Oracle Sem.2

4. We want to remove the specification (but not the body) of package BIGPACK from the database. Which of the following commands will do this? Mark for Review (1) Points

DROP PACKAGE bigpack;

DROP PACKAGE SPECIFICATION bigpack;

DROP PACKAGE bigpack SPECIFICATION;

DROP PACKAGE HEADER bigpack;

None of the above (*)

Correct

5. Examine the following package specification:

CREATE OR REPLACE PACKAGE taxpack IS CURSOR empcurs IS SELECT * FROM employees; PROCEDURE taxproc; END mypack;

The package body of TAXPACK also includes a function called TAXFUNC. Which one of the following statements is NOT true? Mark for Review (1) Points

The procedure can be invoked by:

BEGIN taxpack.taxproc; END;

The packaage will not compile because you cannot declare a cursor in the specification.

(*)

TAXPROC is a public procedure and TAXFUNC is a private function

TAXPROC can invoke TAXFUNC if TAXPROC is coded before TAXFUNC

TAXPROC can open the cursor

Correct

Page 67: Oracle Sem.2

6. When a change is made to the detailed code of a public procedure in a package (but not to the procedure's name or parameters), both the specification and the body must be recompiled. True or False? Mark for Review (1) Points

True

False (*)

Correct

7. Package NEWPACK contains several procedures and functions, including private function PRIVFUNC. From where can PRIVFUNC be invoked? (Choose two.) Mark for Review (1) Points

(Choose all correct answers)

From an anonymous block

From any procedure in NEWPACK (*)

From any private function in another package

From any function in NEWPACK (*)

From any public procedure in another package

Correct

8. Which of the following statements about packages is NOT true ? Mark for Review

(1) Points

All procedures and functions must be declared in the specification. (*)

Cursors can be declared in the specification.

The body contains the detailed code of the subprograms.

Variables can be declared in the body.

The specification must be created before the body.

Correct

Page 68: Oracle Sem.2

9. Every subprogram which has been declared in a package specification must also be included in the package body. Triue or False? Mark for Review (1) Points

True (*)

False

Correct

10. What is wrong with the following syntax for creating a package specification?

CREATE OR REPLACE PACKAGE mypack IS g_constant1 NUMBER(6) := 100; FUNCTION func1 (p_param1 IN VARCHAR2); FUNCTION func2; END mypack; Mark for Review (1) Points

You cannot declare constants in the specification.

A package must contain at least one procedure.

The RETURN datatype of the functions must be specified.

(*)

The first line should be: CREATE OR REPLACE PACKAGE SPECIFICATION mypack IS

Nothing is wrong, this code contains no errors.

Correct

11. Which one of the following can NOT be part of a Package ? Mark for Review (1) Points

Procedures

Explicit cursors

Page 69: Oracle Sem.2

Triggers (*)

Functions

Global variables

Correct

12. Why is it better to use DBMS_OUTPUT only in anonymous blocks, not inside stored subprograms such as procedures? Mark for Review (1) Points

Because DBMS_OUTPUT cannot be used inside procedures

Because anonymous blocks display messages while the block is executing, while procedures do not display anything until their execution has finished

Because DBMS_OUTPUT should be used only for testing and debugging PL/SQL code (*)

Because DBMS_OUTPUT can raise a NO_DATA_FOUND exception if used inside a packaged procedure

Correct

13. Which of the following exceptions can be raised ONLY when using the UTL_FILE package? (Choose two) Mark for Review (1) Points

(Choose all correct answers)

INVALID_PATH (*)

NO_DATA_FOUND

VALUE_ERROR

READ_ERROR (*)

E_MYEXCEP

Correct

14. What will be displayed when the following code is executed?

Page 70: Oracle Sem.2

BEGIN DBMS_OUTPUT.PUT('I do like'); DBMS_OUTPUT.PUT_LINE('to be'); DBMS_OUTPUT.PUT('beside the seaside'); END; Mark for Review (1) Points

I do like to be beside the seaside

I do like to be beside the seaside

I do like to be

I do liketo be

(*)

I do like to be beside the seaside

Correct

15. DBMS_OUTPUT.PUT_LINE can be invoked from inside a private packaged function. True or False? Mark for Review (1) Points

True (*)

False

Correct

16. Package CURSPACK declares a global cursor in the package specification. The package contains three public procedures: OPENPROC opens the cursor; FETCHPROC fetches 5 rows from the cursor's active set; CLOSEPROC closes the cursor.

What will happen when a user session executes the following commands in the order shown? curspack.openproc; -- line 1 curspack.fetchproc; -- line 2 curspack.fetchproc; -- line 3

Page 71: Oracle Sem.2

curspack.openproc; -- line 4 curspack.fetchproc; -- line 5 curspack.closeproc; -- line 6 Mark for Review (1) Points

The first 15 rows will be fetched.

The first 10 rows will be fetched, then the first 5 rows will be fetched again.

The first 5 rows will be fetched three times.

An error will occur at line 2.

An error will occur at line 4. (*)

Correct

17. A cursor is declared in a package specification. User SIOBHAN opens the cursor and fetches the first three rows from the cursor's active set, but does not close the cursor. User FRED now connects to the database. FRED can immediately fetch the next three rows without opening the cursor. True or False? Mark for Review (1) Points

True

False (*)

Correct

18. Which of the following SQL statements can be included in a PL/SQL block only by using Dynamic SQL? (Choose two.) Mark for Review (1) Points

(Choose all correct answers)

DELETE

SAVEPOINT

ALTER (*)

SELECT ..... FOR UPDATE NOWAIT

GRANT (*)

Correct

Page 72: Oracle Sem.2

19. MARY wants HENRY to be able to query her EMPLOYEES table. Mary executes the following code:

DECLARE v_grant_stmt VARCHAR2(50); BEGIN v_grant_stmt := 'GRANT SELECT ON employees TO henry'; DBMS_SQL.EXECUTE(v_grant_stmt); END;

Mary has successfully granted the privilege to Henry. True or False? Mark for Review (1) Points

True

False (*)

Correct

20. A public packaged procedure contains the following SQL statement: UPDATE employees SET salary = salary * 1.1; When is this SQL statement parsed? Mark for Review (1) Points

When the package specification is created

When the package body is created (*)

When the package header is loaded into memory.

When the package is loaded into memory.

Only the first time the procedure is executed.

Incorrect. Refer to Section 9.

21. The easiest way to include DDL statements in a PL/SQL block is to use the DBMS_SQL package. True or False? Mark for Review (1) Points

True

False (*)

Correct

Page 73: Oracle Sem.2

22. Package TAXPACK declares a global variable G_TAXRATE NUMBER(2,2). The value of the tax rate is stored in table TAXTAB in the database. You want to read this value automatically into G_TAXRATE each time a user session makes its first call to TAXPACK. How would you do this? Mark for Review (1) Points

Declare the global variable as: g_taxrate NUMBER(2,2) := SELECT tax_rate FROM taxtab;

Create a database trigger that includes the following code: SELECT tax_rate INTO taxpack.g_taxrate FROM taxtab;

Add a private function to the package body of TAXPACK, and invoke the function from the user session.

Add a package initialization block to the package body of TAXPACK.

(*)

Correct

23. We never need to use a forward declaration when invoking a public subprogram. True or False? Mark for Review (1) Points

True (*)

False

Correct

24. Which two of these declarations cannot be in the same package specification?

PROCEDURE myproc (p1 NUMBER, p2 VARCHAR2); PROCEDURE myproc (p1 VARCHAR2, p2 NUMBER); PROCEDURE myproc (p1 NUMBER, p2 CHAR); PROCEDURE myproc (p1 NUMBER); Mark for Review (1) Points

1 and 2

Page 74: Oracle Sem.2

1 and 3 (*)

2 and 3

3 and 4

1 and 4

Incorrect. Refer to Section 9.

25. Package HRPACK contains the following public function:

FUNCTION empfunc (p_deptno NUMBER) RETURN NUMBER IS BEGIN UPDATE employees SET salary = salary * 1.1 WHERE department_id = p_deptno; RETURN SQL%ROWCOUNT; END empfunc;

What will happen when the following SQL statement is executed?

SELECT department_name, hrpack.empfunc(department_id) FROM departments; Mark for Review (1) Points

The SELECT will fail because you cannot return SQL%ROWCOUNT from a packaged function.

The SELECT will fail because you cannot call packaged functions from within a SQL statement.

The SELECT will fail because you cannot execute a DML statement from within a query.

The SELECT will succeed because it is referencing a different table from the function. (*)

Correct

Section 10

26. What is wrong with the following code?

CREATE TRIGGER dept_trigg BEFORE UPDATE OF department_name ON departments BEGIN DBMS_OUTPUT.PUT_LINE(:NEW.department_name);

Page 75: Oracle Sem.2

END; Mark for Review (1) Points

You cannot use :NEW in a BEFORE trigger, only in an AFTER trigger.

You cannot use :NEW or :OLD in a statement trigger. (*)

You cannot use DBMS_OUTPUT.PUT_LINE inside a trigger.

The second line should be: BEFORE UPDATE ON departments.department_name

Correct

27. A DML statement trigger fires only once for each triggering DML statement, while a row trigger fires once for each row processed by the triggering statement. True or False? Mark for Review (1) Points

True (*)

False

Correct

28. Examine the following code:

CREATE TRIGGER emp_trigg -- Line A BEGIN INSERT INTO log_table VALUES (USER, SYSDATE); END;

Which of the following can NOT be coded at Line A? Mark for Review (1) Points

BEFORE UPDATE ON employees

AFTER INSERT OR DELETE ON employees

AFTER SELECT ON employees (*)

BEFORE DELETE ON employees

AFTER UPDATE OF last_name ON employees

Page 76: Oracle Sem.2

Incorrect. Refer to Section 10.

29. The following code will successfully create emp_trigg: True or False?

CREATE OR REPLACE TRIGGER emp_trigg BEFORE DELETE OF salary ON employees BEGIN RAISE_APPLICATION_ERROR(-20202,'Deleting salary is not allowed'); END; Mark for Review (1) Points

True

False (*)

Incorrect. Refer to Section 10.

30. With which kind of trigger can the :OLD and :NEW qualifiers be used? Mark for Review (1) Points

DDL triggers

Database Event triggers

Statement triggers

Row triggers (*)

AFTER triggers

Incorrect. Refer to Section 10.

31. There are 3 employees in department 90 and 5 employees in department 50. The following trigger has been created:

CREATE TRIGGER upd_emp_trigg AFTER UPDATE ON employees FOR EACH ROW BEGIN ...

A user now executes:

UPDATE employees SET department_id = 50 WHERE department_id = 90;

Page 77: Oracle Sem.2

How many times will the trigger fire? Mark for Review (1) Points

Once

Three times (*)

Four times

Five times

Eight times

Correct

32. Examine the following trigger. It should raise an application error if a user tries to update an employee's last name. It should allow updates to all other columns of the EMPLOYEES table. What should be coded at line A?

CREATE TRIGGER stop_ln_trigg BEFORE UPDATE ON employees BEGIN -- Line A RAISE_APPLICATION_ERROR(-20201,'Updating last name not allowed'); END IF; END; Mark for Review (1) Points

IF UPDATING LAST_NAME THEN

IF UPDATING('LAST_NAME') THEN (*)

IF UPDATE('LAST_NAME') THEN

IF UPDATING THEN

Correct

33. Examine the following code. To create a row trigger, what code should be included at Line A?

CREATE TRIGGER dept_trigg AFTER UPDATE OR DELETE ON departments -- Line A BEGIN ... Mark for Review (1) Points

AFTER EACH ROW

Page 78: Oracle Sem.2

FOR EVERY ROW

FOR EACH ROW (*)

ON EACH ROW

ON EVERY ROW

Correct

34. User AYSEGUL successfully creates the following trigger:

CREATE TRIGGER loc_trigg BEFORE UPDATE ON aysegul.locations BEGIN ....

AYSEGUL now tries to drop the LOCATIONS table. What happens? Mark for Review (1) Points

An error message is displayed because you cannot drop a table that is associated with a trigger.

The table is dropped and the trigger is disabled.

The trigger is dropped but the table is not dropped.

Both the table and the trigger are dropped. (*)

None of the above.

Correct

35. You need to disable all triggers that are associated with DML statements on the DEPARTMENTS table. Which of the following commands should you use? Mark for Review (1) Points

ALTER TABLE departments DISABLE ALL TRIGGERS; (*)

ALTER TRIGGER DISABLE ALL ON departments;

ALTER TABLE departments DISABLE TRIGGERS;

DISABLE ALL TRIGGERS ON departments;

Page 79: Oracle Sem.2

ALTER TABLE departments DROP ALL TRIGGERS;

Correct

36. After the following SQL statement is executed, all the triggers on the DEPARTMENTS table will no longer fire, but will remain in the database. True or False?

ALTER TABLE departments DISABLE ALL TRIGGERS; Mark for Review (1) Points

True (*)

False

Correct

37. You can code COMMIT and ROLLBACK statements in a trigger body. True or False? Mark for Review (1) Points

True

False (*)

Correct

38. A business rule states that an employee's salary cannot be greater than 99,999.99 or less than 0. The best way to enforce this rule is by using: Mark for Review (1) Points

A datatype of NUMBER(7,2) for the SALARY column

A database trigger

A check constraint (*)

An application trigger

A view

Correct

Page 80: Oracle Sem.2

39. What type of database object would you create to write an auditing record automatically every time a user connects to the database? Mark for Review (1) Points

A procedure

A complex view

A trigger (*)

A function

A package

Correct

40. Which of the following are good guidelines to follow when creating a database trigger? (Choose two.) Mark for Review (1) Points

(Choose all correct answers)

Where possible, use a trigger to enforce a foreign key constraint.

Use triggers to override privilege checking and view other users' private tables.

Do not use a trigger to replace or duplicate something which the Oracle Server does automatically. (*)

Use triggers to prevent unauthorized users from SELECTing confidential data.

Do not create a trigger that automatically fires another trigger. (*)

Correct

41. The following objects have been created in a user's schema: - a function FUNC1 - A package PACK1 which contains a public procedure PACKPROC and a private function PACKFUNC - a trigger TRIGG1. The procedure and functions each accept a single IN parameter of type NUMBER, and the functions return BOOLEANs. Which of the following calls to these objects (from an anonymous block) are correct? (Choose two.) Mark for Review (1) Points

Page 81: Oracle Sem.2

(Choose all correct answers)

pack1.packproc(25); (*)

SELECT func1(100) FROM dual;

trigg1;

IF pack1.packfunc(40) THEN ...

IF func1(75) THEN ... (*)

Incorrect. Refer to Section 10.

42. A trigger can be created in the database or within an application. True or False? Mark for Review (1) Points

True (*)

False

Correct

43. Which of the following are NOT stored inside the database? (Choose two.) Mark for Review (1) Points

(Choose all correct answers)

A PL/SQL package specification

A database trigger

An anonymous block (*)

An application trigger (*)

A sequence

Correct

44. Examine this code:

CREATE TRIGGER de_trigg -- Line A

Page 82: Oracle Sem.2

BEGIN ...

Which of the following are NOT valid at Line A ? (Choose two.) Mark for Review (1) Points

(Choose all correct answers)

AFTER LOGOFF ON SCHEMA (*)

AFTER LOGON ON SCHEMA

BEFORE LOGOFF ON SCHEMA

BEFORE DISCONNECT ON SCHEMA (*)

AFTER SERVERERROR ON SCHEMA

Correct

45. What is the purpose of using the CALL statement in a trigger? Mark for Review

(1) Points

It allows an INSTEAD OF trigger to be a statement trigger.

It allows the trigger body code to be placed in a separate procedure. (*)

It prevents cascading triggers.

It allows the trigger body code to be placed in a separate procedure or function.

It allows both DML events and DDL events to be handled using a single trigger.

Correct

46. Which kinds of trigger can cause a mutating table problem? (Choose two.) Mark for Review (1) Points

(Choose all correct answers)

BEFORE UPDATE row triggers (*)

DDL triggers

Page 83: Oracle Sem.2

AFTER DELETE row triggers (*)

Database Event triggers

INSTEAD OF triggers

Correct

47. Which of the following statements could cause a DDL trigger to fire? Mark for Review (1) Points

DROP TABLE employees;

ALTER TABLE departments ADD (budget NUMBER(8,2));

CREATE TABLE newemp AS SELECT * FROM employees;

TRUNCATE TABLE locations;

All of the above (*)

Correct

48. Examine this code:

CREATE TRIGGER new_trigg AFTER CREATE ON reserved_word BEGIN ...

Which of the following can be used in place of reserved_word? (Choose two.) Mark for Review (1) Points

(Choose all correct answers)

TABLE

SCHEMA (*)

USER

DATABASE (*)

TABLE employees

Page 84: Oracle Sem.2

Correct

49. You want to prevent any objects in your schema from being altered or dropped. You decide to create the following trigger:

CREATE TRIGGER stop_ad_trigg -- Line A BEGIN RAISE_APPLICATION_ERROR(-20203,'Invalid Operation'); END;

What should you code at Line A ? Mark for Review (1) Points

AFTER ALTER OR DROP ON SCHEMA

INSTEAD OF ALTER OR DROP ON SCHEMA

BEFORE ALTER OR DROP ON SCHEMA (*)

BEFORE ALTER, DROP ON SCHEMA

AFTER ALTER, DROP ON SCHEMA

Correct

50. The database administrator wants to write a log record every time an Oracle Server error occurs in any user's session. The DBA creates the following trigger:

CREATE TRIGGER log_errs_trigg -- Line A BEGIN INSERT INTO errlog_table VALUES (...); END; What should the DBA code at Line A ? Mark for Review (1) Points

AFTER ERROR ON DATABASE

AFTER SERVER ERROR ON DATABASE

AFTER SERVERERROR ON SCHEMA

AFTER SERVERERROR ON DATABASE (*)

AFTER ORACLE ERROR ON SCHEMA

Incorrect. Refer to Section 10.

Page 85: Oracle Sem.2

1. The PRODUCTS table contains these columns:PRODUCT_ID NUMBER NOT NULL PRODUCT_NAME VARCHAR2 (25)SUPPLIER_ID NUMBER NOT NULLLIST_PRICE NUMBER (7,2)COST NUMBER (5,2)QTY_IN_STOCK NUMBER(4)LAST_ORDER_DT DATE NOT NULL DEFAULT SYSDATEWhich INSERT statement will execute successfully?  INSERT INTO products VALUES (2958, 'Cable', 8690, 7.09, 4.04, 700);(*)  INSERT INTO products VALUES (2958, 'Cable', 8690, 7.09, 4.04, SYSDATE);  INSERT INTO products(product_id, product_name) VALUES (2958, 'Cable');  INSERT INTO products(product_id, product_name, supplier_id VALUES (2958, 'Cable', 8690, SYSDATE);   Correct   2. You have been instructed to add a new customer to the CUSTOMERS table. Because the new customer has not had a credit check, you should not add an amount to the CREDIT column. The CUSTOMERS table contains these columns:CUST_ID NUMBER(10) COMPANY VARCHAR2(30) CREDIT NUMBER(10) POC VARCHAR2(30) LOCATION VARCHAR2(30)Which two INSERT statements will accomplish your objective? Označit pro zhodnocení (1) Body   (Vyberte všechny správné odpovědi)   INSERT INTO customers (cust_id, company, poc, location) VALUES (200, 'InterCargo', 'tflanders', 'samerica');(*)  INSERT INTO customers VALUES (200, 'InterCargo', null, 'tflanders', 'samerica');(*)  INSERT INTO customers VALUES (cust_id, company, credit, poc, location) (200, 'InterCargo', 0, 'tflanders', 'samerica');  INSERT INTO customers VALUES (200, InterCargo, 0, tflanders, samerica); 

Page 86: Oracle Sem.2

  Correct   3. Assume all the column names are correct. The following SQL statement will execute which of the following?INSERT INTO departments (department_id, department_name, manager_id, location_id) VALUES (70, 'Public Relations', 100, 1700); Označit pro zhodnocení (1) Body   100 will be inserted into the department_id column  1700 will be inserted into the manager_id column  70 will be inserted into the department_id column (*)  

ム Public Relations メ will be inserted into the manager_name column   Correct   4. The STUDENTS table contains these columns:STU_ID NUMBER(9) NOT NULL LAST_NAME VARCHAR2 (30) NOT NULL FIRST_NAME VARCHAR2 (25) NOT NULL DOB DATE STU_TYPE_ID VARCHAR2(1) NOT NULL ENROLL_DATE DATEYou create another table, named FT_STUDENTS, with an identical structure.You want to insert all full-time students, who have a STU_TYPE_ID value of "F", into the new table. You execute this INSERT statement:INSERT INTO ft_students (SELECT stu_id, last_name, first_name, dob, stu_type_id, enroll_date FROM students WHERE UPPER(stu_type_id) = 'F');What is the result of executing this INSERT statement? Označit pro zhodnocení (1) Body   All full-time students are inserted into the FT_STUDENTS table. (*)  An error occurs because the FT_STUDENTS table already exists.  An error occurs because you CANNOT use a subquery in an INSERT statement.  An error occurs because the INSERT statement does NOT contain a VALUES clause.   Correct  

Page 87: Oracle Sem.2

5. One of the sales representatives, Janet Roper, has informed you that she was recently married, and she has requested that you update her name in the employee database. Her new last name is Cooper. Janet is the only person with the last name of Roper that is employed by the company. The EMPLOYEES table contains these columns and all data is stored in lowercase:EMPLOYEE_ID NUMBER(10) PRIMARY KEY LAST_NAME VARCHAR2(20)FIRST_NAME VARCHAR2(20)DEPARTMENT_ID VARCHAR2 (20)HIRE_DATE DATESALARY NUMBER(10)Which UPDATE statement will accomplish your objective? Označit pro zhodnocení (1) Body   UPDATE employees SET last_name = 'cooper' WHERE last_name = 'roper'; (*)  UPDATE employees last_name = 'cooper' WHERE last_name = 'roper';  UPDATE employees SET last_name = 'roper' WHERE last_name = 'cooper';  UPDATE employees SET cooper = 'last_name' WHERE last_name = 'roper';   Correct   6. Examine the structures of the PRODUCTS and SUPPLIERS tables:SUPPLIERS SUPPLIER_ID NUMBER NOT NULL, Primary Key SUPPLIER_NAME VARCHAR2 (25) ADDRESS VARCHAR2 (30) CITY VARCHAR2 (25) REGION VARCHAR2 (10) POSTAL_CODE VARCHAR2 (11)PRODUCTS PRODUCT_ID NUMBER NOT NULL, Primary Key PRODUCT_NAME VARCHAR2 (25) SUPPLIER_ID NUMBER Foreign key to SUPPLIER_ID of the SUPPLIERS table CATEGORY_ID NUMBER QTY_PER_UNIT NUMBER UNIT_PRICE NUMBER (7,2) QTY_IN_STOCK NUMBER QTY_ON_ORDER NUMBER REORDER_LEVEL NUMBERYou want to delete any products supplied by the five suppliers located in Atlanta. Which script should you use? Označit pro zhodnocení (1) Body   DELETE FROM products WHERE supplier_id IN

Page 88: Oracle Sem.2

(SELECT supplier_id FROM suppliers WHERE UPPER(city) = 'ATLANTA');(*)  DELETE FROM products WHERE UPPER(city) = 'ATLANTA';  DELETE FROM products WHERE supplier_id = (SELECT supplier_id FROM suppliers WHERE UPPER(city) = 'ATLANTA');  DELETE FROM suppliers WHERE supplier_id IN (SELECT supplier_id FROM suppliers WHERE UPPER(city) = 'ALANTA');   Correct   7. Which of the following represents the correct syntax for an INSERT statement? Označit pro zhodnocení (1) Body   INSERT VALUES INTO customers (3178 J. Smith 123 Main Street Nashville TN 37777;  INSERT INTO customers VALUES '3178' 'J.' 'Smith' '123 Main Street' 'Nashville' 'TN' '37777';  INSERT INTO customers VALUES ('3178', 'J.', 'Smith', '123 Main Street', 'Nashville', 'TN', '37777'); (*)  INSERT customers VALUES 3178, J., Smith, 123 Main Street, Nashville, TN, 37777;   Correct   8. Which two commands can be used to modify existing data in a database row? Označit pro zhodnocení (1) Body   (Vyberte všechny správné odpovědi)   DELETE  MERGE (*)  SELECT  UPDATE (*)   Correct

Page 89: Oracle Sem.2

   9. One of your employees was recently married. Her employee ID is still 189, however, her last name is now Rockefeller. Which SQL statement will allow you to reflect this change? Označit pro zhodnocení (1) Body   INSERT INTO my_employees SET last_name = 'Rockefeller' WHERE employee_ID = 189;  INSERT my_employees SET last_name = 'Rockefeller' WHERE employee_ID = 189;  UPDATE INTO my_employees SET last_name = 'Rockefeller' WHERE employee_ID = 189;  UPDATE my_employees SET last_name = 'Rockefeller' WHERE employee_ID = 189; (*)   Correct   10. When the WHERE clause is missing in a DELETE statement, what is the result? Označit pro zhodnocení (1) Body   All rows are deleted from the table. (*)  The table is removed from the database.  An error message is displayed indicating incorrect syntax.  Nothing. The statement will not execute.   Correct  Test: Mid Term Exam Semester 2 - Part II  Projděte své odpovědi, odezvy a hodnocení otázek dole. Hvězdička (*) značí správnou odpověď.  Semester 2 Mid Term Exam Part II covers Sections 5-7 of Database Programming with SQL also.   Section 7 (Odpovězte na všechny otázky v této části)  11. What keyword in an UPDATE statement speficies the columns you want to change? Označit pro zhodnocení (1) Body   

Page 90: Oracle Sem.2

SELECT  WHERE  SET (*)  HAVING   Correct   12. You need to update the expiration date of products manufactured before June 30th . In which clause of the UPDATE statement will you specify this condition? Označit pro zhodnocení (1) Body   The ON clause  The WHERE clause (*)  The SET clause  The USING clause   Correct   13. Aliases can be used with MERGE statements. True or False? Označit pro zhodnocení (1) Body   True (*)  False   Correct   14. Multi-table inserts are used when the same source data should be inserted into _____________ target table. Označit pro zhodnocení (1) Body   Ten  A very large  More than one (*)  

Page 91: Oracle Sem.2

A data warehouse   Correct     Section 6 (Odpovězte na všechny otázky v této části)  15. The Oracle server performs a correlated subquery when the subquery references a column from a table referred to in the parent. True or False? Označit pro zhodnocení (1) Body   True (*)  False   Correct   16. A correlated subquery will _______ a candidate row from an outer query, _______ the inner query using candidate row value, and _______ values from the inner query to qualify or disqualify the candidate row. Označit pro zhodnocení (1) Body   CREATE; EXECUTE; USE  DELETE; UPDATE; INSERT  GET; EXECUTE; USE (*)  ROLLUP; GRANT; DROP   Incorrect. Refer to Section 6 Lesson 4.   17. The WITH clause enables a SELECT statement to define the subquery block at the start of the query, process the block just once, label the results, and then refer to the results multiple times. True or False? Označit pro zhodnocení (1) Body   True (*)  False   Correct  

Page 92: Oracle Sem.2

18. Which statement is false? Označit pro zhodnocení (1) Body   The WITH clause retrieves the results of one or more query blocks  The WITH clause decreases performance (*)  The WITH clause makes the query simple to read  The WITH clause stores the results for the user who runs the query   Correct   19. Examine the data in the PAYMENT table:>>>>PAYMENT_ID CUSTOMER_ID PAYMENT_DATE PAYMENT_TYPE

PAYMENT_AMOUNT86590586 8908090 10-JUN-03 BASIC 859.0089453485 8549038 15-FEB-03 INTEREST 596.0085490345 5489304 20-MAR-03 BASIC 568.00This statement fails when executed:SELECT payment_date, customer_id, payment_amount FROM payment WHERE payment_id = (SELECT payment_id FROM payment WHERE payment_date >= '05-JAN-2002' OR payment_amount > 500.00);Which change could correct the problem? Označit pro zhodnocení (1) Body   Remove the subquery WHERE clause.  Change the outer query WHERE clause to 'WHERE payment_id IN'. (*)  Include the PAYMENT_ID column in the select list of the outer query.  Remove the single quotes around the date value in the inner query WHERE clause.   Correct   20. Evaluate this SELECT statement:SELECT player_id, name FROM players WHERE team_id IN (SELECT team_id FROM teams WHERE team_id > 300 AND salary_cap > 400000);What would happen if the inner query returned a NULL value? Označit pro zhodnocení (1) Body  

Page 93: Oracle Sem.2

 No rows would be returned by the outer query. (*)  A syntax error in the outer query would be returned.  A syntax error in the inner query would be returned.  All the rows in the PLAYER table would be returned by the outer query.   Correct   Stránka 2 z 5      Test: Mid Term Exam Semester 2 - Part II  Projděte své odpovědi, odezvy a hodnocení otázek dole. Hvězdička (*) značí správnou odpověď.  Semester 2 Mid Term Exam Part II covers Sections 5-7 of Database Programming with SQL also.   Section 6 (Odpovězte na všechny otázky v této části)  21. Which statement about the ANY operator when used with a multiple-row subquery is true? Označit pro zhodnocení (1) Body   The ANY operator compares every value returned by the subquery. (*)  The ANY operator can be used with the DISTINCT keyword.  The ANY operator is a synonym for the ALL operator.  The ANY operator can be used with the LIKE and IN operators.   Correct   22. If a single-row subquery returns a null value and uses the equality comparison operator, what will the outer query return?

Označit pro zhodnocení (1) Body   No rows (*)  All the rows in the table 

Page 94: Oracle Sem.2

 A null value  An error   Correct   23. Which statement about the <> operator is true? Označit pro zhodnocení (1) Body   The <> operator is NOT a valid SQL operator.  The <> operator CANNOT be used in a single-row subquery.  The <> operator returns the same result as the ANY operator in a subquery.  The <> operator can be used when a single-row subquery returns only one row. (*)   Correct   24. Which statement about subqueries is true? Označit pro zhodnocení (1) Body   Subqueries should be enclosed in double quotation marks.  Subqueries cannot contain group functions.  Subqueries are often used in a WHERE clause to return values for an unknown conditional value. (*)  Subqueries generally execute last, after the main or outer query executes.   Correct   25. The EMPLOYEES and ORDERS tables contain these columns:EMPLOYEES EMPLOYEE_ID NUMBER(10) NOT NULL PRIMARY KEY FIRST_NAME VARCHAR2(30) LAST_NAME VARCHAR2(30) ADDRESS VARCHAR2(25) CITY VARCHAR2(20) STATE VARCHAR2(2) ZIP NUMBER(9) TELEPHONE NUMBER(10)

Page 95: Oracle Sem.2

ORDERSORDER_ID NUMBER(10) NOT NULL PRIMARY KEY EMPLOYEE_ID NUMBER(10) NOT NULL FOREIGN KEY ORDER_DATE DATETOTAL NUMBER(10)Which SELECT statement will return all orders generated by a sales representative named Franklin during the year 2001? Označit pro zhodnocení (1) Body   SELECT order_id, total FROM ORDERS (SELECT employee_id FROM employees WHERE last_name = 'Franklin') WHERE order_date BETWEEN '01-jan-01' AND '31-dec-01';  SELECT (SELECT employee_id FROM employees WHERE last_name = 'Franklin') AND order_id, total FROM ORDERS WHERE order_date BETWEEN '01-jan-01' AND '31-dec-01';  SELECT order_id, employee_id, total FROM ORDERS WHERE order_date BETWEEN '01-jan-01' AND '31-dec-01' AND emp_id = 'Franklin';  SELECT order_id, total FROM ORDERS WHERE employee_id = (SELECT employee_id FROM employees WHERE last_name = 'Franklin') AND order_date BETWEEN '01-jan-01' AND '31-dec-01';(*)   Correct   26. The TEACHERS and CLASS_ASSIGNMENTS tables contain these columns:TEACHERS TEACHER_ID NUMBER(5) Primary Key NAME VARCHAR2 (25) SUBJECT_ID NUMBER(5)CLASS_ASSIGNMENTS CLASS_ID NUMBER (5) Primary Key TEACHER_ID NUMBER (5) DATE MAX_CAPACITY NUMBER (3)All MAX_CAPACITY values are greater than 10. Which two SQL statements correctly use subqueries? (Choose two.) Označit pro zhodnocení (1) Body   (Vyberte všechny správné odpovědi)   SELECT * FROM class_assignments WHERE max_capacity = (SELECT AVG(max_capacity) FROM class_assignments);(*)  

Page 96: Oracle Sem.2

SELECT * FROM teachers WHERE teacher_id = (SELECT teacher_id FROM teachers WHERE class_id = 45963);(*)  SELECT * FROM teachers WHERE teacher_id = (SELECT teacher_id, class_assignments WHERE max_capacity > 0);  SELECT * FROM teachers WHERE teacher_id LIKE (SELECT teacher_id FROM class_assignments WHERE max_capacity > 1000);  SELECT * FROM class_assignments max_capacity = (SELECT AVG(max_capacity) FROM class_assignments GROUP BY teacher_id);   Correct   27. Which operator can be used with a multiple-row subquery? Označit pro zhodnocení (1) Body   IN (*)  <>  =  LIKE   Correct   28. Using a subquery in which clause will return a syntax error? Označit pro zhodnocení (1) Body   WHERE  FROM  HAVING  You can use subqueries in all of the above clauses. (*)  

Page 97: Oracle Sem.2

Correct   29. Which operator can be used with subqueries that return only one row? Označit pro zhodnocení (1) Body   LIKE (*)  ANY  ALL  IN   Correct   30. Which of the following is TRUE regarding the order of subquery execution? Označit pro zhodnocení (1) Body   The outer query is executed first  The subquery executes once after the main query  The subquery executes once before the main query (*)  The result of the main query is used with the subquery   Correct   Stránka 3 z 5      Test: Mid Term Exam Semester 2 - Part II  Projděte své odpovědi, odezvy a hodnocení otázek dole. Hvězdička (*) značí správnou odpověď.  Semester 2 Mid Term Exam Part II covers Sections 5-7 of Database Programming with SQL also.   Section 6 (Odpovězte na všechny otázky v této části)  31. You need to create a report to display the names of products with a cost value greater than the average cost of all products. Which SELECT statement should you use? Označit pro zhodnocení

Page 98: Oracle Sem.2

(1) Body   SELECT product_name FROM products WHERE cost > (SELECT AVG(cost) FROM product);(*)  SELECT product_name FROM products WHERE cost > AVG(cost);  SELECT AVG(cost), product_name FROM products WHERE cost > AVG(cost) GROUP by product_name;  SELECT product_name FROM (SELECT AVG(cost) FROM product) WHERE cost > AVG(cost);   Correct     Section 5 (Odpovězte na všechny otázky v této části)  32. You use ROLLUP to: Označit pro zhodnocení (1) Body   produce subtotal values (*)  cross-tabulate values  produce a single result set   Correct   33. CUBE can be applied to all aggregate functions including AVG, SUM, MIN, MAX, and COUNT. True or False? Označit pro zhodnocení (1) Body   True (*)  False   Correct  

Page 99: Oracle Sem.2

34. You use GROUPING function to: Označit pro zhodnocení (1) Body   Produce subtotal and cross-tabulated values  Identify the extra row values created by either a ROLLUP or CUBE operation (*)  Aggregate rows using SUM, MIN, MAX, and COUNT   Correct   35. You use GROUPING function to ______ database rows from tabulated rows. Označit pro zhodnocení (1) Body   CREATE  DISTINGUISH (*)  COMPUTE  COUNT   Correct   36. The PRODUCTS table contains these columns:PRODUCT_ID NUMBER(9) PK CATEGORY_ID VARCHAR2(10) LOCATION_ID NUMBER(9) DESCRIPTION VARCHAR2(30) COST NUMBER(7,2) PRICE NUMBER(7,2) QUANTITY NUMBERYou display the total of the extended costs for each product category by location. You need to include only the products that have a price less than $25.00. The extended cost of each item equals the quantity value multiplied by the cost value. Which SQL statement will display the desired result? Označit pro zhodnocení (1) Body   SELECT category_id, SUM(cost * quantity) TOTAL,location_id FROM products WHERE price > 25.00 GROUP BY category_id, location_id;  SELECT SUM(cost * quantity) TOTAL, location_id FROM products

Page 100: Oracle Sem.2

WHERE price < 25.00 <br /> GROUP BY location_id;  SELECT category_id, SUM(cost * quantity) TOTAL, location_id FROM products WHERE price < 25.00 <br /> GROUP BY category_id, location_id;(*)  SELECT SUM(cost * quantity) TOTAL FROM products WHERE price < 25.00;   Correct   37. The PRODUCTS table contains these columns:PROD_ID NUMBER(4) PROD_NAME VARCHAR(20) PROD_CAT VARCHAR2(15) PROD_PRICE NUMBER(5) PROD_QTY NUMBER(4)You need to identify the minimum product price in each product category. Which statement could you use to accomplish this task? Označit pro zhodnocení (1) Body   SELECT prod_cat, MIN (prod_price) FROM products GROUP BY prod_price;  SELECT prod_cat, MIN (prod_price) FROM products GROUP BY prod_cat;(*)  SELECT MIN (prod_price), prod_cat FROM products GROUP BY MIN (prod_price), prod_cat;  SELECT prod_price, MIN (prod_cat) FROM products GROUP BY prod_cat;   Correct   38. The PLAYERS and TEAMS tables contain these columns:PLAYERS PLAYER_ID NUMBER NOT NULL, PRIMARY KEY LAST_NAME VARCHAR2 (30) NOT NULL FIRST_NAME VARCHAR2 (25) NOT NULLTEAM_ID NUMBER POSITION VARCHAR2 (25)TEAMS TEAM_ID NUMBER NOT NULL, PRIMARY KEY TEAM_NAME VARCHAR2 (25)

Page 101: Oracle Sem.2

You need to create a report that lists the names of each team with more than three goal keepers. Which SELECT statement will produce the desired result? Označit pro zhodnocení  SELECT t.team_name, COUNT(p.player_id) FROM players p, teams t ON (p.team_id = t.team_id) WHERE UPPER(p.position) = 'GOAL KEEPER' GROUP BY t.team_name;  SELECT t.team_name, COUNT(p.player_id) FROM players JOIN teams t ON (p.team_id = t.team_id) WHERE UPPER(p.position) = 'GOAL KEEPER' HAVING COUNT(p.player_id) > 3;  SELECT t.team_name, COUNT(p.player_id) FROM players p, teams t ON (p.team_id = t.team_id) WHERE UPPER(p.position) = 'GOAL KEEPER' GROUP BY t.team_name HAVING COUNT(p.player_id) > 3;  SELECT t.team_name, COUNT(p.player_id) FROM players p JOIN teams t ON (p.team_id = t.team_id) WHERE UPPER(p.position) = 'GOAL KEEPER' GROUP BY t.team_name HAVING COUNT(p.player_id) > 3;(*)   Correct   39. Evaluate this SELECT statement:SELECT SUM(salary), department_id, manager_id FROM employees GROUP BY department_id, manager_id;Which SELECT clause allows you to restrict the rows returned, based on a group function? Označit pro zhodnocení (1) Body   HAVING SUM(salary) > 100000 (*)  WHERE SUM(salary) > 100000  WHERE salary > 100000  HAVING salary > 100000   Correct   40. Evaluate this SELECT statement: SELECT MAX(salary), department_id

Page 102: Oracle Sem.2

FROM employees GROUP BY department_id;Which values are displayed? Označit pro zhodnocení (1) Body   The highest salary for all employees.  The highest salary in each department. (*)  The employees with the highest salaries.  The employee with the highest salary for each department.  Test: Mid Term Exam Semester 2 - Part II  Projděte své odpovědi, odezvy a hodnocení otázek dole. Hvězdička (*) značí správnou odpověď.  Semester 2 Mid Term Exam Part II covers Sections 5-7 of Database Programming with SQL also.   Section 5 (Odpovězte na všechny otázky v této části)  41. Evaluate this SELECT statement:SELECT COUNT(employee_id), department_id FROM employees GROUP BY department_id;You only want to include employees who earn more than 15000. Which clause should you include in the SELECT statement? Označit pro zhodnocení (1) Body   WHERE salary > 15000 (*)  HAVING salary > 15000  WHERE SUM(salary) > 15000  HAVING SUM(salary) > 15000   Correct   42. What is the correct order of clauses in a SELECT statement? Označit pro zhodnocení (1) Body   SELECT FROM WHERE ORDER BY GROUP BY

Page 103: Oracle Sem.2

HAVING  SELECT FROM HAVING GROUP BY WHERE ORDER BY  SELECT FROM WHERE GROUP BY HAVING ORDER BY(*)  SELECT FROM WHERE HAVING ORDER BY GROUP BY   Correct   43. The EMPLOYEES table contains these columns:ID_NUMBER NUMBER Primary Key NAME VARCHAR2 (30) DEPARTMENT_ID NUMBER SALARY NUMBER (7,2) HIRE_DATE DATEEvaluate this SQL statement:SELECT id_number, name, department_id, SUM(salary) FROM employees WHERE salary > 25000 GROUP BY department_id, id_number, name ORDER BY hire_date;Why will this statement cause an error?

The HAVING clause is missing.  The WHERE clause contains a syntax error.  The SALARY column is NOT included in the GROUP BY clause.  The HIRE_DATE column is NOT included in the GROUP BY clause. (*)   Correct   44. Evaluate this statement:SELECT department_id, AVG(salary) FROM employees WHERE job_id <> 69879 GROUP BY job_id, department_id

Page 104: Oracle Sem.2

HAVING AVG(salary) > 35000 ORDER BY department_id;Which clauses restricts the result? Choose two.     SELECT department_id, AVG(salary)  WHERE job_id <> 69879 (*)  GROUP BY job_id, department_id  HAVING AVG(salary) > 35000 (*)   Correct   45. Which statement about group functions is true? Group functions ignore null values. (*)  Group functions can only be used in a SELECT list.  Group functions can be used in a WHERE clause.  A query that includes a group function in the SELECT list must include a GROUP BY clause.   Correct   46. The PAYMENT table contains these columns:PAYMENT_ID NUMBER(9) PK PAYMENT_DATE DATE CUSTOMER_ID NUMBER(9)Which SELECT statement could you use to display the number of times each customer payment was made between January 1, 2003 and June 30, 2003 ? Označit pro zhodnocení (1) Body   SELECT customer_id, COUNT(payment_id) FROM payment WHERE payment_date BETWEEN '01-JAN-2003' AND '30-JUN-2003' GROUP BY customer_id;(*)  SELECT COUNT(payment_id) FROM payment WHERE payment_date BETWEEN '01-JAN-2003' AND '30-JUN-2003';  SELECT customer_id, COUNT(payment_id) FROM payment WHERE payment_date BETWEEN '01-JAN-2003' AND '30-JUN-2003'; 

Page 105: Oracle Sem.2

 SELECT COUNT(payment_id) FROM payment WHERE payment_date BETWEEN '01-JAN-2003' AND '30-JUN-2003' GROUP BY customer_id;   Correct   47. What is the best explanation as to why this SQL statement will NOT execute?SELECT department_id "Department", AVG (salary)"Average" FROM employees GROUP BY Department;   Salaries cannot be averaged as not all the numbers will divide evenly.  You cannot use a column alias in the GROUP BY clause. (*)  The GROUP BY clause must have something to GROUP.  The department id is not listed in the departments table.   Correct   48. The PLAYERS table contains these columns:PLAYER_ID NUMBER PK PLAYER_NAME VARCHAR2 (30) TEAM_ID NUMBER HIRE_DATE DATE SALARY NUMBER (8,2)Which clauses represent valid uses of aggregate functions? (Choose three.) (1) Body    ORDER BY AVG(salary) (*)  GROUP BY MAX(salary)  SELECT AVG(NVL(salary, 0)) (*)  HAVING MAX(salary) > 10000 (*)  WHERE hire_date > AVG(hire_date)   Correct   49. To control the order of rows returned using SET operators, the ORDER BY clause is used ______ and is placed in the _____ SELECT statement of the query. Označit pro zhodnocení

Page 106: Oracle Sem.2

(1) Body   ONCE; FIRST  TWICE; FIRST  ONCE; LAST (*)  IN ALL; LAST   Correct   50. When using SET operators the number of columns and the data types of the columns must be identical in all of the SELECT statements used in the query. True or False. Označit pro zhodnocení (1) Body   True (*)  False   Incorrect. Refer to Section 5 Lesson 3.