Quiz 2
Quiz 2
False (*)
Correct
Create an entity that is unlike any other entity aside from itself.
Correct
False
Correct
4. The logical model becomes the blueprint for designing the ________ model
Mark for Review
(1) Points
Physical (*)
Network
Data Integrity
Data Flow
Correct
Nouns (*)
Verbs
Adverbs
Correct
6. Entity
names Mark for Review
are (1) Points
always
singular.
True or
False?
True (*)
False
Correct
False
Correct
Data Integrity
Less Redundancy
Correct
False
mandatory
maybe
must (*)
Incorrect. Refer to Section 2 Lesson 6.
Section 2 Quiz
(Answer all questions in this section)
11. An ERD created using ERDish is a __________ representation of entities and their
relationships to each other. Mark for Review
(1) Points
graphical (*)
textual
hierarchical
technical
Correct
Takes into account regulations and laws goverining the industry being addressed.
Correct
13. Which of the following are true about Cardinality? (Choose two)
Mark for Review
(1) Points
(Choose all correct answers)
Cardinality specifies only singularity or plurality, but not a specific plural number.
(*)
Cardinality tells "how many". (*)
Correct
Single or Multiple
Correct
Mandatory
One to one
Hierarchical
Correct
2. A model is considered to be Implementation-Free if it can be implemented using ____ Mark for Review
of the database software models such as hierarchical, network or relational. (1) Points
any (*)
only one
none
Correct
3. Which of the following statements about entity relationship diagrams (ERD) is true? Mark for Review
(1) Points
Used to communicate the physical structure of the database to users.
Used to communicate the logical structure of the database to users. (*)
Is a hard and fast document that cannot be changed once development of the
database has begun.
Used to communicate the technical specifications of the database to users
Incorrect. Refer to Section 2 Lesson 6.
4. A table must have a primary key. True or False? Mark for Review
(1) Points
True (*)
False
Correct
5. Each column in a relation is called an entity. True or False? Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 2 Lesson 1.
Page 1 of 3 Next Summary
6. In an ERD, Mark for Review
optionality is (1) Points
depicted using
__________.
names of relationships
soft boxes
Correct
Cardinality
Optionality
Names
Correct
Single or Multiple
Correct
9. Which symbol is used to show that a particular attribute is Mark for Review
mandatory? (1) Points
* (*)
o
&
Correct
Nouns (*)
Verbs
Adverbs
Adjectives
Correct
True (*)
False
Correct
Conceptual (*)
Physical
Data Integrity
Network
Correct
13. Which of the following are reasons we create conceptual models? Mark for Review
(1) Points
It facilitates discussion; a picture is worth a thousand words
Correct
Distinguish nothing
Correct
15. A candidate UID that does not get chosen to become the primary UID is Mark for Review
called a _________ . (1) Points
Primary UID
Composite UID
Unique UID
2. If a relationship is mandatory there must be at least one instance of the Mark for Review
corresponding entity related to it. (1) Points
True (*)
False
Correct
3. One-to-One relationships have _____________ of one to one in both directions. Mark for Review
(1) Points
Optionality
Naming
Foreign Keys
Cardinality (*)
Correct
4. Which of the following would be good as a Unique Identifier for its Entity? (Choose Mark for Review
Three) (1) Points
(Choose all correct answers)
Personal Identification number for Person (*)
Date of birth for Baby
ISBN Number for Book (*)
Vehicle Registration Number for Car (*)
Correct
5. A Unique Identifier has a NULL value for each instance of the entity for the lifetime Mark for Review
of the instance. True or False (1) Points
True
False (*)
Correct
7. A relational database stores information in tables with rows and columns. Mark for Review
(1) Points
True (*)
False
Correct
8. The logical model becomes the blueprint for designing the ________ model Mark for Review
(1) Points
Data Integrity
Physical (*)
Network
Data Flow
Correct
9. The logical model's entities, attributes, unique identifiers and relationships map to the Mark for Review
physical model's _________________. (1) Points
Optionality and Cardinality
Tables, columns, primary keys and foreign keys (*)
Files, records, fields and data values
Correct
10. Using ERDish, which wording represents optionality? (Choose Two) Mark for Review
(1) Points
(Choose all correct answers)
mandatory
maybe
must (*)
may (*)
Correct
only one
none
Correct
12. Which of the following statements about entity relationship Mark for Review
diagrams (ERD) is true? (1) Points
True (*)
False
14. Which of the following entities most likely contains invalid Mark for Review
attributes? (1) Points
15. An entity may have which of the following? Mark for Review
(1) Points
Experiences
Instances (*)
Tables
Correct
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 15
1. What would you use in the SELECT clause to return all the columns in the table? Mark for Review
(1) Points
Correct.
FROM employees;
If the RAISE_PERCENT column only contains null values, what will the statement return?
(1) Points
Only zeroes
A null value or a numeric value depending on the value of the SALARY column
(1) Points
Commas (*)
Semicolons
Dashes
Underscores
Correct.
SALARY NUMBER(7,2)
BONUS NUMBER(7,2)
COMMISSION_PCT NUMBER(2,2)
All three columns contain values greater than zero. There is one row of data in the table and the values
are as follows:
FROM employees;
2.
FROM employees;
(1) Points
(1) Points
Correct.
SELECT *
FROM transaction
Which SQL SELECT statement capabilities are achieved when this statement is executed?
(1) Points
Projection only
Correct.
7. In which clause of a SELECT statement would you specify the name of the table or tables being
queried? Mark for Review
(1) Points
Any of the above options, you can list tables wherever you want to in a SELECT statement.
Correct.
Section 16
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
EMAIL VARCHAR2(50)
You are writing a SELECT statement to retrieve the names of employees that have an email address.
SELECT last_name||', '||first_name "Employee Name"
FROM employees;
(1) Points
9. You need to display all the values in the EMAIL column that contains the underscore (_) character as
part of that email address. The WHERE clause in your SELECT statement contains the LIKE operator.
What must you include in the LIKE operator? Mark for Review
(1) Points
The ESCAPE option (\) and one or more percent signs (%)
10. You want to determine the orders that have been placed by customers who reside in Chicago. You
write this partial SELECT statement:
FROM orders;
What should you include in your SELECT statement to achieve the desired results?
(1) Points
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 16
PLAYER_ID NUMBER(9)
LAST_NAME VARCHAR2(20)
(1) Points
SELECT *
FROM employees
(1) Points
DEPARTMENT_ID = 10 and SALARY = 20000
13. Which of the following commands will display the last name concatenated with the job ID from the
employees table, separated by a comma and space, and label the resulting column "Employee and
Title"? Mark for Review
(1) Points
SELECT " last name" ||', '|| "job_id" + "Employee and Title" FROM employees;
SELECT last_name||', '|| job_id "Employee and Title" FROM employees; (*)
SELECT " last name" ||', '|| "job_id" + "Employee and Title" FROM emp;
(1) Points
15. When using the LIKE condition, which symbol represents any sequence of none, one or more
characters? Mark for Review
(1) Points
% (*)
&
(1) Points
A column name
A comparison condition
A constant
Correct.
17. Which comparison operator searches for a specified character pattern? Mark for Review
(1) Points
IN
LIKE (*)
BETWEEN...AND...
IS NULL
Incorrect. See Section 16 Lesson 1.
18. Where in a SQL statement can you not use arithmetic operators? Mark for Review
(1) Points
SELECT
FROM (*)
WHERE
NONE
19. Which comparison condition would you use to select rows that match a character pattern? Mark
for Review
(1) Points
IN
LIKE (*)
ALMOST
SIMILAR
Incorrect. See Section 16 Lesson 1.
20. The Concatenation Operator does which of the following? Mark for Review
(1) Points
Links two or more columns or literals to form a single output column (*)
Separates columns.
Page 2 of 5
Section 12
21. What command will return data from the database to you? Mark for Review
(1) Points
FETCH
GET
SELECT (*)
RETURN
22. The _______ clause can be added to a SELECT statement to return a subset of the data. Mark for
Review
(1) Points
ANYWHERE
WHICH
WHERE (*)
EVERY
23. What command can be used to create a new row in a table in the database? Mark for Review
(1) Points
CREATE
NEW
ADD
INSERT (*)
(1) Points
1 (*)
25. The SQL statement ALTER TABLE EMPLOYEES DELETE COLUMN SALARY is a valid statement. True or
False? Mark for Review
(1) Points
True
False (*)
Section 11
26. In a physical data model, an attribute becomes a _____________. Mark for Review
(1) Points
Table
Foreign Key
Constraint
Column (*)
27. In an Oracle database, why would 1_TABLE not work as a table name? Mark for Review
(1) Points
Object names must not start with a number. They must begin with a letter (*)
28. The transformation from an ER diagram to a physical design involves changing terminology.
Secondary Unique Identifiers become Mark for Review
(1) Points
Columns
Tables
(1) Points
True
False (*)
30. If a primary key is a set of columns then one column must be null. True or False? Mark for Review
(1) Points
True
False (*)
Page 3 of 5
Test: Final Exam Semester 1
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 11
31. A foreign key cannot refer to a primary key in the same table. True or False? Mark for Review
(1) Points
True
False (*)
32. A table must have a primary key. True or False? Mark for Review
(1) Points
True
False (*)
33. Identify all of the incorrect statements that complete this sentence: A primary key is: (Choose
three) Mark for Review
(1) Points
One or more columns in a table that uniquely identifies each row in that table
A set of columns in one table that uniquely identifies each row in another table (*)
34. An "Arc Implementation" can be done just like any other Relationship - you simply add the
required Foreign Keys. True or False? Mark for Review
(1) Points
True
False (*)
35. The Oracle Database can implement a many to many relationship. You simply create two foreign
keys between the two tables. True or False? Mark for Review
(1) Points
True
False (*)
Section 17
FROM employees
ORDER BY last_name;
(1) Points
The rows will be sorted in reverse alphabetical order by the LAST_NAME values.
The rows will be sorted alphabetically by the FIRST_NAME and then the LAST_NAME values
FROM employees;
(1) Points
The database will display the rows in whatever order it finds it in the database, so no particular order.
(*)
The results will be sorted ascending by the LAST_NAME column only.
Correct.
SELECT *
FROM employees
WHERE department_id = 34
OR department_id = 45
OR department_id = 67;
Which operator is the equivalent of the OR conditions used in this SELECT statement?
(1) Points
IN (*)
AND
LIKE
SELECT price
FROM products
(1) Points
50
25 (*)
10
250 (*)
FROM employees
ORDER BY last_name, 3;
(1) Points
FROM employees
ORDER BY last_name, 3;
Page 4 of 5
Test: Final Exam Semester 1
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 17
SELECT employee_id
FROM employees
(1) Points
19
100, 101, 102, 103, 104, 107, 124, 141, 142, 143, 144, 149 (*)
200, 201, 202, 203, 204, 205, 206
This statement fails when executed. Which change will correct the problem?
(1) Points
Correct.
43. The PLAYERS table contains these columns:
PLAYERS TABLE:
SALARY NUMBER(8,2)
TEAM_ID NUMBER(4)
MANAGER_ID NUMBER(9)
POSITION_ID NUMBER(4)
You must display the player name, team id, and salary for players whose salary is in the range from
25000 through 100000 and whose team id is in the range of 1200 through 1500. The results must be
sorted by team id from lowest to highest and then further sorted by salary from highest to lowest.
Which statement should you use to display the desired result?
(1) Points
FROM players
FROM players
(*)
SELECT last_name, first_name, team_id, salary
FROM players
FROM players
PLAYERS TABLE:
SALARY NUMBER(8,2)
TEAM_ID NUMBER(4)
MANAGER_ID NUMBER(9)
POSITION_ID NUMBER(4)
You want to display all players' names with position 6900 or greater. You want the players names to be
displayed alphabetically by last name and then by first name. Which statement should you use to
achieve the required results?
(1) Points
FROM players
(*)
FROM players
FROM players
FROM players
45. Which statement about the default sort order is true? Mark for Review
(1) Points
46. Which of the following best describes the meaning of the LIKE operator? Mark for Review
(1) Points
47. Which comparison condition means ?Less Than or Equal To"? Mark for Review
(1) Points
"=)"
"+<"
">="
"<=" (*)
48. You need to change the default sort order of the ORDER BY clause so that the data is displayed in
reverse alphabetical order. Which keyword should you include in the ORDER BY clause? Mark for
Review
(1) Points
DESC (*)
ASC
SORT
CHANGE
Correct.
49. Which clause would you include in a SELECT statement to sort the rows returned by the
LAST_NAME column? Mark for Review
(1) Points
ORDER BY (*)
WHERE
FROM
HAVING
Correct.
50. Which logical operator returns TRUE if either condition is true? Mark for Review
(1) Points
OR (*)
AND
NOT
BOTH
Correct.
Page 5 of 5
Section 3 Quiz
(Answer all questions in this section)
1. Evaluate this SELECT statement:
Mark for Review
SELECT * (1) Points
FROM employees
WHERE department_id = 34
OR department_id = 45
OR department_id = 67;
Which operator is the equivalent of the OR conditions used in this SELECT statement?
LIKE
IN (*)
AND
Correct.
The OR and AND conditions have the same precedence and will be evaluated from
right to left
The AND condition will be evaluated before the OR condition. (*)
Correct.
ORDER BY last_name, 3;
FROM employees
Correct.
The rows will be sorted in reverse alphabetical order by the LAST_NAME values.
The rows will be sorted alphabetically by the FIRST_NAME and then the
LAST_NAME values
The rows will not be sorted.
Correct.
5. What clause must you place in a SQL statement to have your results sorted from
highest to lowest salary? Mark for Review
(1) Points
None, the database always sorts from highest to lowest on the salary column.
Correct
">="
"=)"
"+<"
Correct.
OR (*)
BOTH
AND
Correct.
False
Correct.
10. Which clause would you include in a SELECT statement to sort the rows returned by
the LAST_NAME column? Mark for Review
(1) Points
WHERE
FROM
ORDER BY (*)
HAVING
Correct.
11. Evaluate this
SQL Mark for Review
statement: (1) Points
SELECT
e.employee_id,
e.last_name,
e.first_name,
m.manager_id
FROM
employees e,
employees m
ORDER BY
e.last_name,
e.first_name
WHERE
e.employee_id
=
m.manager_id;
This statement
fails when
executed.
Which change
will correct the
problem?
Include a HAVING clause.
Correct.
1.
SELECT DISTINCT department_id DEPT, last_name, first_name
FROM employees
ORDER BY department_id;
2.
SELECT department_id DEPT, last_name, first_name
FROM employees
ORDER BY DEPT;
You must display the player name, team id, and salary for players whose
salary is in the range from 25000 through 100000 and whose team id is in
the range of 1200 through 1500. The results must be sorted by team id
from lowest to highest and then further sorted by salary from highest to
lowest. Which statement should you use to display the desired result?
SELECT last_name, first_name, team_id, salary
FROM players
WHERE salary BETWEEN 24999.99 AND 100000.01
AND team_id BETWEEN 1200 AND 1500
ORDER BY team_id DESC, salary DESC;
SELECT last_name, first_name, team_id, salary
FROM players
WHERE salary BETWEEN 25000 AND 100000
AND team_id BETWEEN 1200 AND 1500
ORDER BY team_id, salary DESC;
(*)
SELECT last_name, first_name, team_id, salary
FROM players
WHERE (salary > 25000 OR salary < 100000)
AND team_id BETWEEN 1200 AND 1500
ORDER BY team_id, salary;
SELECT last_name, first_name, team_id, salary
FROM players
WHERE salary > 24999.99 AND salary < 100000
AND team_id BETWEEN 1200 AND 1500
ORDER BY team_id ASC, salary DESC;
Correct.
False
Correct
False (*)
Correct
Section 5
Three
Four
Two (*)
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?
Mark for Review
(1) Points
Displays each job id and the number of people assigned to that job id. (*)
Displays all the jobs with as many people as there are jobs.
Correct
5. What is the correct order of clauses in a SELECT statement? 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
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
SELECT COUNT(payment_id)
FROM payment
WHERE payment_date BETWEEN '01-JAN-2003' AND '30-JUN-2003';
SELECT COUNT(payment_id)
FROM payment
WHERE payment_date BETWEEN '01-JAN-2003' AND '30-JUN-2003'
GROUP BY customer_id;
GROUP BY MAX(salary)
You need to display the number of unique types of manufacturers at each location. Which SELECT statement should
you use?
Mark for Review
(1) Points
Correct
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
You only want to include employees who earn more than 15000.
Which clause should you include in the SELECT statement?
Mark for Review
(1) Points
Page 1 of 5
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Semester 2 Mid Term Exam Part II covers Sections 5-7 of Database Programming with SQL.
Section 5
(Answer all questions in this section)
11. 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;
Mark for Review
(1) Points
Salaries cannot be averaged as not all the numbers will divide evenly.
Correct
The hire dates in the EMPLOYEES table that contain NULL values.
Correct
Correct
Identify the extra row values created by either a ROLLUP or CUBE operation (*)
15. CUBE can be applied to all aggregate functions including AVG, SUM, MIN, MAX, and COUNT. True or False? Mark
for Review
(1) Points
True (*)
False
cross-tabulate values
17. You use GROUPING function to ______ database rows from tabulated rows. Mark for Review
(1) Points
CREATE
DISTINGUISH (*)
COMPUTE
COUNT
Correct
18. 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? Mark for Review
(1) Points
True
False (*)
Correct
19. 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. Mark for Review
(1) Points
ONCE; FIRST
TWICE; FIRST
IN ALL; LAST
Correct
Section 7
(Answer all questions in this section)
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?
Mark for Review
(1) Points
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;
UPDATE employees
SET salary = salary * .10, bonus = bonus * .15
WHERE department_id = 10;
Correct
Page 2 of 5
Semester 2 Mid Term Exam Part II covers Sections 5-7 of Database Programming with SQL.
Section 7
(Answer all questions in this section)
21. What would happen if you issued a DELETE statement without a WHERE clause? Mark for Review
(1) Points
22. Which of the following represents the correct syntax for an INSERT statement? Mark for Review
(1) Points
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;
23. 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
(1) Points
The ON clause
24. Examine the structures of the PLAYERS, MANAGERS, and TEAMS tables:
PLAYERS
PLAYER_ID NUMBER Primary Key
LAST_NAME VARCHAR2 (30)
FIRST_NAME VARCHAR2 (25)
TEAM_ID NUMBER
MGR_ID NUMBER
SIGNING_BONUS NUMBER(9,2)
SALARY NUMBER(9,2)
MANAGERS
MANAGER_ID NUMBER Primary Key
LAST_NAME VARCHAR2 (20)
FIRST_NAME VARCHAR2 (20)
TEAM_ID NUMBER
TEAMS
TEAM_ID NUMBER Primary Key
TEAM_NAME VARCHAR2 (20)
OWNER_LAST_NAME VARCHAR2 (20)
OWNER_FIRST_NAME VARCHAR2 (20)
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
You want to execute one DML statement to change the salary of all employees in department 10 to equal the new
salary of employee number 89898. Currently, all employees in department 10 have the same salary value. Which
statement should you execute?
Mark for Review
(1) Points
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;
(*)
UPDATE employees
SET salary = (SELECT salary FROM employees WHERE employee_id = 89898 AND department_id = 10);
CLASS_ASSIGNMENTS
CLASS_ID NUMBER(5)
TEACHER_ID NUMBER(5)
START_DATE DATE
MAX_CAPACITY NUMBER(3)
You need to display the start date for each class taught by a given teacher.
You need to create a report to display the teachers who were hired more than five years ago.
You need to display the names of the teachers who teach classes that start within the next week.
You need to create a report to display the teachers who teach more classes than the average number of classes
taught by each teacher. (*)
Correct
27. 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 KEY
LAST_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?
Mark for Review
(1) Points
DELETE *
FROM employees
WHERE employee_id = 348;
DELETE 'jones'
FROM employees;
You want to add the following row data to the PRODUCTS 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.
29. 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 for Review
(1) Points
An ON clause
A SET clause
A subquery (*)
A function
Page 3 of 5
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Semester 2 Mid Term Exam Part II covers Sections 5-7 of Database Programming with SQL.
Section 7
(Answer all questions in this section)
31. 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);
Mark for Review
(1) Points
Correct
32. Aliases can be used with MERGE statements. True or False? Mark for Review
(1) Points
True (*)
False
33. 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
A data warehouse
Correct
Section 6
(Answer all questions in this section)
34. A correlated subquery is evaluated _____ for each row processed by the parent statement. Mark for Review
(1) Points
EVERY TIME
ONCE (*)
COMPLETELY
Correct
35. 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
The WITH clause retrieves the results of one or more query blocks
The WITH clause decreases performance (*)
The WITH clause stores the results for the user who runs the query
37. 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
38. Which comparison operator can only be used with a single-row subquery? Mark for Review
(1) Points
ANY
ALL
<> (*)
IN
Correct
39. 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? Mark for Review
(1) Points
SELECT *
FROM employees
WHERE supervisor_id = (SELECT supervisor_id
FROM employees
WHERE last_name = 'Carter');
SELECT *
FROM supervisors
WHERE supervisor_id =
(SELECT supervisor_id
FROM employees
WHERE last_name = 'Carter');
SELECT *
FROM supervisors
WHERE supervisor_id =
(SELECT employee_id
FROM supervisors
WHERE last_name = 'Carter');
SELECT *
FROM employees
WHERE supervisor_id =
(SELECT employee_id
FROM employees
WHERE last_name = 'Carter');
(*)
40. What would happen if you attempted to use a single-row operator with a multiple-row subquery? Mark for
Review
(1) Points
Correct
Page 4 of 5
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Semester 2 Mid Term Exam Part II covers Sections 5-7 of Database Programming with SQL.
Section 6
(Answer all questions in this section)
The department ID, department name and last name for every employee in the Executive department.
The department ID, last name, department name for every Executive in the employees table.
The department ID, last name, job ID from departments for Executive employees.
The department ID, last name, job ID for every employee in the Executive department. (*)
42. A multiple-row operator expects how many values? Mark for Review
(1) Points
Only one
Two or more
None
Correct
43. If you use the equality operator (=) with a subquery, how many values can the subquery return? Mark for
Review
(1) Points
Only 1 (*)
Up to 2
Up to 5
Unlimited
Correct
44. 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?
Mark for Review
(1) Points
You need to display the date each customer account was opened.
You need to display all the orders that were placed on a certain date.
You need to display all the orders that were placed on the same day as order number 25950. (*)
45. 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? Mark for Review
(1) Points
SELECT product_name
FROM products
WHERE cost > (SELECT AVG(cost)
FROM product);
(*)
SELECT product_name
FROM products
WHERE cost > AVG(cost);
SELECT product_name
FROM (SELECT AVG(cost) FROM product)
WHERE cost > AVG(cost);
Incorrect. Refer to Section 6 Lesson 1.
46. Which operator can be used with a multiple-row subquery? Mark for Review
(1) Points
IN (*)
<>
LIKE
Correct
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.)
Mark for Review
(1) Points
SELECT *
FROM class_assignments
WHERE max_capacity = (SELECT AVG(max_capacity) FROM class_assignments);
(*)
SELECT *
FROM teachers
WHERE teacher_id = (SELECT teacher_id FROM class_assignments 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);
ORDERS
Which SELECT statement will return all orders generated by a sales representative named Franklin during the year
2001?
Mark for Review
(1) Points
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';
Correct
49. 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? Mark for Review
(1) Points
>
<=
>= (*)
50. Which operator can be used with subqueries that return only one row? Mark for Review
(1) Points
LIKE (*)
ANY
ALL
IN
1. When you resolve a M:M, you simply re-draw the relationships between the
two original entities; no new entities are created. True or False? Mark for Review
(1) Points
True
False (*)
Correct Correct
(1) Points
Supertype Relationship
Recursive Relationship
Hierarchical Relationship
(1) Points
zero
two
one
Correct Correct
(1) Points
Mandatory
Transferable
Optional
Non-Transferable (*)
Correct Correct
5. A ___________ relationship is created when the UID for an entity includes the
relationship with another entity. Mark for Review
(1) Points
recursive
one to one
many to many
barred (*)
The transformation from an ER diagram to a physical design involves changing terminology. Primary
Unique Identifiers in the ER diagram become __________ and relationships become ____________.
Mark for Review
(1) Points
Correct Correct
(1) Points
True (*)
False
Incorrect Incorrect. Refer to Section 3 Lesson 4.
(1) Points
Column
Correct Correct
9. A new system would have a mixture of both Procedural and Structural Business
Rules as part of the documentation of that new system. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
10. Why is it important to follow the rules of normalization? Mark for Review
(1) Points
(1) Points
When all non-UID attributes are dependent upon the entire UID. (*)
When no attritibutes are mutually independent and all are fully dependent on the primary key.
Correct Correct
12. Would it be a good idea to model age as an attribute of STUDENT? Mark
for Review
(1) Points
Yes
Yes, it would prevent our having to calculate someone's age every time we need it.
Correct Correct
(1) Points
Each non-key attribute is fully functional dependent on the table's primary key.
Both A and B must be true. (*)
(1) Points
non-transferable relationship
recursive relationship
Incorrect Incorrect. Refer to Section 3 Lesson 2.
15. Which of the following would be a logical constraint when modeling time for a
City entity? Mark for Review
(1) Points
If you are doing a system for any French City, you would need security clearance.
Daily traffic patterns must be monitored to determine how many law enforcement officers are
needed.
Cites may change their names and/or country association if the borders of a country change. (*)
People are born in the city and people die in the city.
Correct Correct
11. Which of the following statements about subtypes is not true? Mark for Review
(1) Points
Inherits all attributes of the supertype.
12. The "Other" subtype is mandatory. True or False? Mark for Review
(1) Points
True
False (*)
(1) Points
14. Intersection Entities are at the ______ end of the newly created 1:M
(Parent:Child) relationship; Mark for Review
(1) Points
Single
Barred
Parent
Child (*)
15. What do you call the entity created when you resolve a M:M relationship?
Mark for Review
(1) Points
M:M entity
Inclusion entity
6. An entity
without Mark for Review
repeated (1) Points
values is
said to be in
__________.
2nd normal form
Correct
7. A table is in 3NF if it has met all database requirements for both 1NF and 2NF
and all transitive dependencies are eliminated. Mark for Review
(1) Points
True (*)
False
Correct
False
Correct
Correct
10. The Rule of 3rd Normal Form states that No Non-UID attribute can be
dependent on another non-UID attribute. True or False? Mark for Review
(1) Points
True (*)
False
Correct
1. The
transformation Mark for Review
from an ER (1) Points
diagram to a
physical
design
involves
changing
terminology.
Secondary
Unique
Identifiers
become
_____.
Tables
Columns
Correct
two-table
many to many
single-table (*)
multiple-table
Correct
Correct
Correct
5. Modeling historical data can produce a unique identifier that includes dates.
True or False? Mark for Review
(1) Points
True (*)
False