Quiz DP 12

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Section 12 Quiz

(Answer all questions in this section)


1. If a default value was set for a null column, Oracle sets the column to the default value.
However, if no default value was set when the column was created, Oracle inserts an Mark for Review
empty space. True or False? (1) Points

True
False (*)

Correct
2. In developing the Employees table, you create a column called hire_date. You assign
the hire_date column a DATE datatype with a DEFAULT value of 0 (zero). A user can Mark for Review
come back later and enter the correct hire_date. This is __________. (1) Points

A great idea. When a new employee record is entered, if no hire_date is specified,


the 0 (zero) will be automatically specified.
A great idea. When new employee records are entered, they can be added faster
by allowing the 0's (zeroes) to be automatically specified.
Both a and b are correct.
A bad idea. The default value must match the DATE datatype of the column. (*)

Incorrect. Refer to Section 12 Lesson 3.


3. Which statement below will not insert a row of data into a table?
Mark for Review
(1) Points
INSERT INTO student_table (id, lname, fname, lunch_num)
VALUES (143352, 'Roberts', 'Cameron', DEFAULT);
INSERT INTO student_table (id, lname, fname, lunch_num)
VALUES (143354, 'Roberts', 'Cameron', 6543);
INSERT INTO (id, lname, fname, lunch_num)
VALUES (143354, 'Roberts', 'Cameron', 6543);

(*)
INSERT INTO student_table
VALUES (143354, 'Roberts', 'Cameron', 6543);
Correct
4. Using MERGE accomplishes an __________ and __________ simultaneously.
Mark for Review
(1) Points
UPDATE; SELECT
INSERT; SELECT
INSERT; UPDATE (*)
UPDATE; DELETE

Correct
5. Aliases can be used with MERGE statements. True or False?
Mark for Review
(1) Points
True (*)
False

Correct

Section 12 Quiz
(Answer all questions in this section)
6. 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. Mark for Review
Her new last name is Cooper. Janet is the only person with the last name of Roper (1) Points
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 DATE
SALARY NUMBER(10)

Which UPDATE statement will accomplish your objective?


UPDATE employees
SET last_name = 'cooper'
WHERE last_name = 'roper'; (*)
UPDATE employees
SET cooper = 'last_name'
WHERE last_name = 'roper';
UPDATE employees
SET last_name = 'roper'
WHERE last_name = 'cooper';
UPDATE employees last_name = 'cooper'
WHERE last_name = 'roper';
Correct
7. You need to remove a row from the EMPLOYEES table. Which statement would you
use? Mark for Review
(1) Points
UPDATE with a WHERE clause
DELETE with a WHERE clause (*)
MERGE with a WHERE clause
INSERT with a WHERE clause

Correct
8. Which two commands can be used to modify existing data in a database row?
Mark for Review
(1) Points
(Choose all correct answers)
UPDATE (*)
SELECT
MERGE (*)
DELETE

Incorrect. Refer to Section 12 Lesson 2.


9. Which of the following statements best describes what will happen to the student
table in this SQL statement? Mark for Review
(1) Points
UPDATE students
SET lunch_number =
(SELECT lunch_number
FROM student
WHERE student_id = 17)
WHERE student_id = 19;
Deletes student 17's lunch_number and inserts a new value from student 19.
Does nothing as you cannot use subqueries in UPDATE statements.
The statement updates the student_table by replacing student id 19's lunch
number with student id 17's lunch number. (*)
Inserts a new row into the students table.

Correct
10. 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 Mark for Review
change? (1) Points

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

Section 12 Quiz
(Answer all questions in this section)
11. Which statement about the VALUES clause of an INSERT statement is true?
Mark for Review
(1) Points
If no column list is specified, the values must be listed in the same order that the
columns are listed in the table. (*)
To specify a null value in the VALUES clause, use an empty string (" ").
The VALUES clause in an INSERT statement is mandatory in a subquery.
Character, date, and numeric data must be enclosed within single quotes in the
VALUES clause.
Correct
12. DML is an acronym that stands for:
Mark for Review
(1) Points
Debit Markup Language
Data Markup Language
Don't Manipulate Language
Data Manipulation Language (*)

Correct
13. When inserting rows into a table, all columns must be given values. True or False?
Mark for Review
(1) Points
True
False (*)

Correct
14. Which of the following statements will add a new customer to the customers table in
the Global Fast Foods database? Mark for Review
(1) Points
INSERT IN customers (id, first_name, last_name, address, city, state, zip,
phone_number);
INSERT INTO customers (id, first_name, last_name, address, city, state, zip,
phone_number)
VALUES (145, 'Katie', 'Hernandez', '92 Chico Way', 'Los Angeles', 'CA', 98008,
8586667641);

(*)
INSERT INTO customers
(id 145, first_name 'Katie', last_name 'Hernandez', address '92 Chico Way', city
'Los Angeles', state 'CA', zip 98008, phone_number 8586667641);
INSERT INTO customers (id, first_name, last_name, address, city, state, zip,
phone_number)
VALUES ("145", 'Katie', 'Hernandez', '92 Chico Way', 'Los Angeles', 'CA', "98008",
"8586667641");
Correct
15. Assume all the column names are correct. The following SQL statement will execute
which of the following? Mark for Review
(1) Points
INSERT INTO departments
(department_id, department_name, manager_id, location_id)
VALUES (70, 'Public Relations', 100, 1700);
100 will be inserted into the department_id column.
1700 will be inserted into the manager_id column.
'Public Relations' will be inserted into the manager_name column.
70 will be inserted into the department_id column. (*)

Correct

You might also like