Mid Term Ex Semester 2 Part 2
Mid Term Ex Semester 2 Part 2
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 5
(Answer all questions in this section)
1. You use ROLLUP to:
Mark for
Review
(1) Points
Mark for
Review
(1) Points
Mark for
Review
(1) Points
True (*)
False
Correct
4. You use GROUPING functions to ______ database rows from tabulated rows.
Mark for
Review
(1) Points
CREATE
DISTINGUISH (*)
COMPUTE
COUNT
Correct
5. 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.
Mark for
Review
(1) Points
True (*)
False
Correct
6. The ___________ operator returns all rows from both tables, after eliminating
duplicates.
Mark for
Review
(1) Points
UNION (*)
UNION ALL
INTERSECT
MINUS
Correct
7. What will the following SQL Statement do?
SELECT job_id, COUNT(*)
FROM employees
GROUP BY job_id;
Mark for
Review
(1) Points
Mark for
CATEGORY_ID VARCHAR2(10)
LOCATION_ID NUMBER(9)
DESCRIPTION VARCHAR2(30)
COST NUMBER(7,2)
PRICE NUMBER(7,2)
QUANTITY NUMBER
Review
(1) Points
You 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?
Mark for
Review
(1) Points
To exclude rows before dividing them into groups using the GROUP BY
clause, you should use a WHERE clause. (*)
You can use a column alias in a GROUP BY clause.
By default, rows are not sorted when a GROUP BY clause is used.
You must use the HAVING clause with the GROUP BY clause.
Correct
10. The PAYMENT table contains these columns:
PAYMENT_ID NUMBER(9) PK
PAYMENT_DATE DATE
Mark for
Review
(1) Points
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 ?
Mark for
Review
(1) Points
Which SELECT clause allows you to restrict the rows returned, based on a
group function?
Mark for
Review
(1) Points
Mark for
Review
(1) Points
Which SELECT statement will return the information that you require?
Mark for
Review
(1) Points
HAVING clause
JOIN clause
ORDER BY clause
GROUP BY clause (*)
Correct
15. Which statement about group functions is true?
Mark for
Review
(1) Points
Mark for
Review
(1) Points
Mark for
Review
(1) Points
Mark for
Review
(1) Points
SELECT
FROM
WHERE
ORDER BY
GROUP BY
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
19. 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?
Mark for
Review
(1) Points
Section 6
(Answer all questions in this section)
20. Which statement about the <> operator is true?
Mark for
Review
(1) Points
Mark for
Review
(1) Points
No rows (*)
All the rows in the table
A null value
An error
Correct
22. Which best describes a multiple-row subquery?
Mark for
Review
(1) Points
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
Correct
23. Evaluate the structure of the EMPLOYEES and DEPART_HIST tables:
EMPLOYEES
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 DATE
You want to generate a list of employees who are in department 10, but
used to be in department 15. Which query should you use?
Mark for
Review
(1) Points
Mark for
Review
(1) Points
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
25. 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
Mark for
Review
(1) Points
True (*)
False
Correct
27. 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
(1) Points
True (*)
False
Correct
28. Which statement is false?
Mark for
Review
(1) Points
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
29. Which operator can be used with subqueries that return only one row?
Mark for
Review
(1) Points
LIKE (*)
ANY
ALL
IN
Correct
30. 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)
ORDERS
Mark for
Review
(1) Points
Correct
Section 6
(Answer all questions in this section)
31. Examine the structures of the CUSTOMER and ORDER_HISTORY tables:
CUSTOMER
CUSTOMER_ID NUMBER(5)
NAME VARCHAR2(25)
CREDIT_LIMIT NUMBER(8,2)
OPEN_DATE DATE
ORDER_HISTORY
ORDER_ID NUMBER(5)
CUSTOMER_ID NUMBER(5)
ORDER_DATE DATE
TOTAL NUMBER(8,2)
Which of the following scenarios would require a subquery to return the
desired results?
You need to display the date each customer account was opened.
Mark for
Review
(1) Points
Mark for
Review
(1) Points
SELECT product_name
FROM products
WHERE cost > (SELECT AVG(cost)
FROM products);
(*)
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
33. Which statement about subqueries is true?
Mark for
Review
(1) Points
Mark for
Review
(1) Points
Only 1 (*)
Up to 2
Up to 5
Unlimited
Correct
35. Using a subquery in which clause will return a syntax error?
Mark for
Review
(1) Points
WHERE
FROM
HAVING
You can use subqueries in all of the above clauses. (*)
Correct
36. Which operator can be used with a multiple-row subquery?
Mark for
Review
(1) Points
IN (*)
<>
=
LIKE
Correct
Section 7
(Answer all questions in this section)
37. You need to remove a row from the EMPLOYEES table. Which statement
would you use?
Mark for
Review
(1) Points
Correct
38. What keyword in an UPDATE statement speficies the column that you want
to change?
Mark for
Review
(1) Points
SELECT
WHERE
SET (*)
HAVING
Correct
39. You need to update the area code of employees that live in Atlanta.
Evaluate this partial UPDATE statement:
UPDATE employee
SET area_code = 770
Mark for
Review
(1) Points
UPDATE employees
SET last_name = 'cooper'
Mark for
Review
(1) Points
Section 7
(Answer all questions in this section)
41. 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 for
Review
(1) Points
The ON clause
The WHERE clause (*)
The SET clause
The USING clause
Correct
42. Which two commands can be used to modify existing data in a database
row?
Mark for
Review
(1) Points
Mark for
Review
(1) Points
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?
Mark for
Review
(1) Points
Mark for
Review
(1) Points
UPDATE
INSERT (*)
DELETE
CREATE
Correct
46. Using the INSERT statement and assuming that a column can accept null
values, how can you insert a null value in a column?
Mark for
Review
(1) Points
Mark for
Review
(1) Points
CUST_ID NUMBER(10)
COMPANY VARCHAR2(30)
CREDIT NUMBER(10)
POC VARCHAR2(30)
LOCATION VARCHAR2(30)
Which two INSERT statements will accomplish your objective?
Mark for
Review
(1) Points
An ON clause
A SET clause
A subquery (*)
A function
Correct
49. Multi-table inserts are used when the same source data should be inserted
into _____________ target table.
Mark for
Review
(1) Points
Ten
A very large
More than one (*)
A data warehouse
Correct
50. A DEFAULT value can be specified for a column when the table is created.
True or false?
Mark for
Review
(1) Points
True (*)
False
Correct