Only Click My Ads Brother, Help this Site Alive

Friday, July 15, 2016

SOLOSOLOKU: Section 12 Quiz

Section 12 Quiz

(Answer all questions in this section)
1. Multi-table inserts can be conditional or unconditional. True or False?
True (*)
False

2. Using MERGE accomplishes an __________ and __________ simultaneously.
INSERT; UPDATE (*)
UPDATE; SELECT
UPDATE; DELETE
INSERT; SELECT

3. A column in a table can be given a default value. This option prevents NULL values 
from automatically being assigned to the column if a row is inserted without a specified value for the column. True or False ?
True (*)
False

4. The MERGE function combines the;
CREATE and UPDATE commands
INSERT and UPDATE commands (*)
ALTER and UPDATE commands
All of the above

5. A DEFAULT value can be specified for a column when the table is created. True or 
false?
True (*)
False

Section 12 Quiz
6. 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 of 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 products
VALUES (null,'6-foot nylon leash', 10);

What row data did you add to the table?
The row was created completely wrong. No data ended up in the correct columns.
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.

7. If the employees table has 7 rows, how many rows are inserted into the copy_emps table with the following statement:
INSERT INTO copy_emps (employee_id, first_name, last_name, salary, department_id)
SELECT employee_id, first_name, last_name, salary, department_id
FROM employees

7 rows, as no WHERE-clause restricts the rows returned on the subquery. (*)
10 rows will be created.
No rows, as the SELECT statement is invalid.
No rows, as you cannot use subqueries in an insert statement.

8. What is the quickest way to use today's date when you are creating a new row?
Use the TODAYS_DATE function.
Use the SYSDATE function. (*)
Simply write today's date in the format 'dd-mon-rrrr'.
Simply use the keyword DATE in the insert statement.

9. Insert statements can be combined with subqueries to create more than one row per statement. True or False?
True (*)
False

10.  Which of the following statements will add a new customer to the customers table in the Global Fast Foods database?
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, 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 IN customers (id, first_name, last_name, address, city, state, zip, phone_number);
Section 12 Quiz

11. Evaluate this statement:
DELETE FROM customer;

Which statement is true?
The statement deletes the first row in the CUSTOMERS table.
The statement removes the structure of the CUSTOMER table from the database.
The statement deletes all the rows from the CUSTOMER table. (*)
The statement deletes the CUSTOMER column.

12. The TEACHERS and CLASS_ASSIGNMENTS tables contain these columns:
TEACHERS:
TEACHER_ID NUMBER(5)
NAME VARCHAR2(25)
SUBJECT_ID NUMBER(5)
HIRE_DATE DATE
SALARY NUMBER(9,2)

CLASS_ASSIGNMENTS:
CLASS_ID NUMBER(5)
TEACHER_ID NUMBER(5)
START_DATE DATE
MAX_CAPACITY NUMBER(3)

Which scenario would require a subquery to return the desired results?
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 we
You need to create a report to display the teachers who teach more classes than the average number of classes taught by each teacher. (*)

13. Which of the following represents the correct syntax for an INSERT statement? Mark 
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' '377
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;

14. What keyword in an UPDATE statement speficies the column that you want to change?
HAVING
SELECT
SET (*)
WHERE

15. When the WHERE clause is missing in a DELETE statement, what is the result?
Nothing. The statement will not execute.
All rows are deleted from the table. (*)
An error message is displayed indicating incorrect syntax.
The table is removed from the database.

No comments:

Post a Comment