Database Programming Section 13 Quiz
Section 13 Quiz
(Answer all questions in this section)
1. Evaluate the structure of the EMPLOYEE table:
EMPLOYEE_ID NUMBER(9)
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
DEPARTMENT_ID NUMBER(9)
MANAGER_ID NUMBER(9)
SALARY NUMBER(7,2)
Which statement should you use to increase the LAST_NAME column
length to 35 if the column currently contains 200 records?
Mark for Review
(1) Points
You CANNOT increase the width of the LAST_NAME column.
ALTER TABLE employee
MODIFY (last_name VARCHAR2(35));
(*)
ALTER employee TABLE
ALTER COLUMN (last_name VARCHAR2(35));
ALTER TABLE employee
RENAME last_name VARCHAR2(35);
2. The PLAYERS table contains these columns:
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?
Mark for Review
(1) Points
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);
3. You can use DROP COLUMN to drop all columns in a table,
leaving a table structure with no columns. True or False? Mark for
Review
(1) Points
True
False (*)
4. Comments can be added to a table by using the COMMENT ON
TABLE statement. The comments being added are enclosed in: Mark
for Review
(1) Points
Brackets { }
Single quotes ' ' (*)
Parentheses ( )
Double quotes " "
5. Comments on tables and columns can be stored for
documentation by: Mark for Review
(1) Points
Using the ALTER TABLE CREATE COMMENT syntax
Embedding /* comment */ within the definition of the table.
Using an UPDATE statement on the USER_COMMENTS table
Using the COMMENT ON TABLE or COMMENT on COLUMN (*)
(Answer all questions in this section)
6. The BLOB datatype can max hold 128 Terabytes of data. True or
False? Mark for Review
(1) Points
True (*)
False
7. Which data types stores variable-length character data? Select
two. Mark for Review
(1) Points
(Choose all correct answers)
NCHAR
CHAR
CLOB (*)
VARCHAR2 (*)
8. A table has a column: RESPONSE_TIME. This is used to store
the difference between the time the problem was reported and the
time the problem was resolved. Data in the RESPONSE_TIME
column needs to be stored in days, hours, minutes and seconds.
Which data type should you use? Mark for Review
(1) Points
INTERVAL DAY TO SECOND (*)
DATETIME
TIMESTAMP
INTERVAL YEAR TO MONTH
9. The SPEED_TIME column should store a fractional second value.
Which data type should you use?
Mark for Review
(1) Points
DATE
INTERVAL DAY TO SECOND
DATETIME
TIMESTAMP (*)
10. 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 (*)
(Answer all questions in this section)
11. Which statement about creating a table is true? Mark for Review
(1) Points
If a schema is explicitly included in a CREATE TABLE statement and
the schema does not exist, it will be created.
With a CREATE TABLE statement, a table will always be created in
the current user's schema.
If no schema is explicitly included in a CREATE TABLE statement,
the CREATE TABLE statement will fail.
If no schema is explicitly included in a CREATE TABLE statement,
the table is created in the current user's schema. (*)
12. It is possible to create a table by using the CREATE TABLE
command in conjunction with a subquery. True or False? Mark for
Review
(1) Points
True (*)
False
13. Given this employee table:
(employee_id NUMBER(10) NOT NULL,
first_name VARCHAR2(25) NOT NULL,
last_name VARCHAR2(30) NOT NULL,
hire_date DATE DEFAULT sysdate)
What will be the result in the hire_date column following this insert
statement:
INSERT INTO employees VALUES (10, 'Natacha', 'Hansen',
DEFAULT);
Mark for Review
(1) Points
The column for hire_date will be null.
Statement will fail, as you must list the columns into which you are
inserting.
The character string SYSDATE.
Statement will work and the hire_date column will have the value of
the date when the statement was run. (*)
14. Which column name is valid? Mark for Review
(1) Points
1NUMBER
NUMBER
NUMBER_1$ (*)
1_NUMBER#
15. Which SQL statement below will correctly create the EMP table
based on the structure of the EMPLOYEES table? Include only the
EMPLOYEE_ID, FIRST_NAME, LAST_NAME, SALARY, and
DEPARTMENT_ID columns. Mark for Review
(1) Points
CREATE TABLE employee
AS SELECT employee_id, first_name, last_name, salary,
department_id
FROM employees;
CREATE TABLE emp
SELECT (employee_id, first_name, last_name, salary, department_id
FROM employees);
CREATE TABLE emp (employee_id, first_name, last_name, salary,
department_id);
CREATE TABLE emp
AS SELECT employee_id, first_name, last_name, salary,
department_id
FROM employees;
(*)