Quiz DP 13

You might also like

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

Section 13 Quiz

(Answer all questions in this section)

1. Evaluate this CREATE TABLE statement:


 Mark for Review 
CREATE TABLE sales  (1) Points
( sales_id NUMBER(9), 
customer_id NUMBER(9), 
employee_id NUMBER(9), 
description VARCHAR2(30), 
sale_date TIMESTAMP WITH LOCAL TIME ZONE DEFAULT SYSDATE, 
sale_amount NUMBER(7,2));

Which business requirement will this statement accomplish?

Description values can range from 0 to 30 characters so the column should be


fixed in length.
Sales identification values could be either numbers or characters, or a combination
of both.
All employee identification values are only 6 digits so the column should be
variable in length.
Today's date should be used if no value is provided for the sale date. (*)

Correct

2. The SPEED_TIME column should store a fractional second value.


 Mark for Review 
Which data type should you use? (1) Points

DATE

DATETIME
TIMESTAMP (*)

INTERVAL DAY TO SECOND

Correct

3. A column that will be used to store binary data up to 4 Gigabytes in size should be
defined as which datatype?  Mark for Review 
(1) Points

NUMBER

LONGRAW
BLOB (*)

LONG

Correct
4. Which of the following are valid Oracle datatypes?
 Mark for Review 
(1) Points

DATE, BLOB, LOB, VARCHAR2

SYSDATE, TIMESTAMP, DATE, LOCAL TIME ZONE


DATE, TIMESTAMP WITH LOCAL TIME ZONE, BLOB (*)

TIMESTAMP, LOB, VARCHAR2, NUMBER

Correct

5. To store large amounts of text you should simply create a series of VARCHAR2 columns
in a table. True or False?  Mark for Review 
(1) Points

True

False (*)

Correct

Section 13 Quiz

(Answer all questions in this section)

6.  I have a table named School_Friends in my schema. You want to build a table in your
schema named School_Friends. This is ______________, because  Mark for Review 
____________________________________. (1) Points

possible; my schema is separate from yours, and it is okay for us to have like-
named tables in our separate schemas. (*)
impossible; School_Friends is a reserved term in SQL.

impossible; no matter what, there can never be two tables with the same name,
even if they are in separate schemas.
possible; our data will merge into one table, and we can more easily access our
mutual friends information.

Correct

7.  Which statement about table and column names is true?


 Mark for Review 
(1) Points

If any character other than letters or numbers is used in a table or column name,
the name must be enclosed in double quotation marks.
Table and column names must begin with a letter. (*)

Table and column names can begin with a letter or a number.


Table and column names cannot include special characters.
Correct

8.  When creating a new table, which of the following naming rules apply. (Choose three)
 Mark for Review 
(1) Points

(Choose all correct answers)

Can have the same name as another object owned by the same user
Must contain ONLY A - Z, a - z, 0 - 9, _ (underscore), $, and # (*)

Must be an Oracle reserved word


Must be between 1 to 30 characters long (*)

Must begin with a letter (*)

Correct

9.  Which of the following SQL statements will create a table called Birthdays with three
columns for storing employee number, name and date of birth?  Mark for Review 
(1) Points

CREATE table BIRTHDAYS (employee number, name, date of birth);

CREATE TABLE Birthdays (Empno NUMBER, Empname CHAR(20), Date of Birth


DATE);
CREATE TABLE Birthdays (Empno NUMBER, Empname CHAR(20), Birthdate
DATE); (*)
CREATE table BIRTHDAYS (EMPNO, EMPNAME, BIRTHDATE);

Correct

10. Evaluate this CREATE TABLE statement:


 Mark for Review 
(1) Points
1. CREATE TABLE customer#1 ( 
2. cust_1 NUMBER(9), 
3. sales$ NUMBER(9), 
4. 2date DATE DEFAULT SYSDATE);

Which line of this statement will cause an error?

4 (*)
2

1
3

Correct

Section 13 Quiz

(Answer all questions in this section)


11. Evaluate this statement: 
ALTER TABLE employees SET UNUSED (fax);  Mark for Review 
(1) Points
Which task will this statement accomplish?

Frees the disk space used by the data in the FAX column
Prevents data in the FAX column from being displayed, by performing a logical
drop of the column (*)
Prevents a new FAX column from being added to the EMPLOYEES table
Deletes the FAX column

Correct

12. After issuing a SET UNUSED command on a column, another column with the same
name can be added using an ALTER TABLE statement. True or False?  Mark for Review 
(1) Points

True (*)
False

Correct

13. Examine the structure of the DONATIONS table.


 Mark for Review 
DONATIONS:  (1) Points
PLEDGE_ID NUMBER 
DONOR_ID NUMBER 
PLEDGE_DT DATE 
AMOUNT_PLEDGED NUMBER (7,2) 
AMOUNT_PAID NUMBER (7,2) 
PAYMENT_DT DATE

You need to reduce the precision of the AMOUNT_PLEDGED column to 5 with a scale
of 2 and ensure that when inserting a row into the DONATIONS table without a value
for the AMOUNT_PLEDGED column, a price of $10.00 will automatically be inserted.
The DONATIONS table currently contains NO records. Which statement is true?

You must use the ADD OR REPLACE option to achieve these results.

You CANNOT decrease the width of the AMOUNT_PLEDGED column.


You must drop and recreate the DONATIONS table to achieve these results.

Both changes can be accomplished with one ALTER TABLE statement. (*)

Correct

14. The PLAYERS table contains these columns:


 Mark for Review 
(1) Points
PLAYER_ID NUMBER(9) PRIMARY KEY 
LAST_NAME VARCHAR2(20) 
FIRST_NAME VARCHAR2(20) 
TEAM_ID NUMBER(4) 
SALARY NUMBER(9,2)

Which statement should you use to decrease the width of the FIRST_NAME column to
10 if the column currently contains 1500 records, but none are longer than 10 bytes
or characters?

ALTER TABLE players 


MODIFY (first_name VARCHAR2(10));
(*)
ALTER TABLE players 
RENAME first_name VARCHAR2(10);
ALTER players TABLE 
MODIFY COLUMN (first_name VARCHAR2(10));
ALTER players TABLE 
MODIFY COLUMN first_name VARCHAR2(10);

Correct

15. You can use the ALTER TABLE statement to:


 Mark for Review 
(1) Points

Add a new column

Modify an existing column


Drop a column

All of the above (*)

Correct

You might also like