Database Programming With SQL Final Exam
Database Programming With SQL Final Exam
Section 12
(Answer all questions in this section)
True (*)
False
First; Second
All; Second
Null; Default
You want to add the following row of data to the PRODUCTS table:
The row was created with the correct data in two of three columns.
The row was created with the correct data in all three columns. (*)
UPDATE
CREATE
INSERT (*)
DELETE
DELETE 'jones'
FROM employees;
DELETE *
FROM employees
WHERE employee_id = 348;
Section 13
(Answer all questions in this section)
9. You can use the ALTER TABLE statement to: Mark for Review
(1) Points
Drop a column
10. You need to remove all the data in the SCHEDULE table, the
structure of the table, and the indexes associated with the table.
Which statement should you use? Mark for Review
(1) Points
ALTER TABLE
DELETE TABLE
TRUNCATE TABLE
11. Which statement about a column is NOT true? Mark for Review
(1) Points
You can convert a CHAR data type column to the VARCHAR2 data
type.
You can modify the data type of a column if the column contains non-
null data. (*)
Rename a row.
Rename a column.
13. When you use ALTER TABLE to add a column, the new column:
Mark for Review
(1) Points
Will not be created because you cannot add a column after the table
is created
You must drop and recreate the DONATIONS table to achieve these
results.
TIMESTAMP
DATETIME
TIMESTAMP (*)
DATE
17. Which statement about creating a table is true? Mark for Review
(1) Points
18. Once they are created, external tables are accessed with normal
SQL statements. (True or False?) Mark for Review
(1) Points
True (*)
False
An external table with the data stored in a file outside the database.
(*)
A View.
An external table with the data stored in a file inside the database.
Section 14
(Answer all questions in this section)
20. Which constraint can only be created at the column level? Mark
for Review
(1) Points
UNIQUE
FOREIGN KEY
CHECK
21. A table can only have one unique key constraint defined. True or
False? Mark for Review
(1) Points
True
False (*)
True
False (*)
ON DELETE CASCADE
REFERENCES (*)
FOREIGN KEY
(Answer all questions in this section)
ON DELETE CASCADE
ON DELETE SET NULL
Both A and B
Section 15
(Answer all questions in this section)
27. When you drop a view, the data it contains is also deleted. True
or False? Mark for Review
(1) Points
True
False (*)
28. You want to create a view based on the SALESREP table. You
plan to grant access to this view to members of the Sales department.
You want Sales employees to be able to update the SALESREP table
through the view, which you plan to name SALESREP_VIEW. What
should not be specified in your CREATE VIEW statement? Mark for
Review
(1) Points
A WHERE clause
The AS keyword
The IN keyword
30. Only one type of view exists. True or False? Mark for Review
(1) Points
True
False (*)
Section 15
(Answer all questions in this section)
31. Your manager has just asked you to create a report that
illustrates the salary range of all the employees at your company.
Which of the following SQL statements will create a view called
SALARY_VU based on the employee last names, department names,
salaries, and salary grades for all employees? Use the EMPLOYEES,
DEPARTMENTS, and JOB_GRADES tables. Label the columns
Employee, Department, Salary, and Grade, respectively. Mark for
Review
(1) Points
CREATE OR REPLACE VIEW salary_vu
AS SELECT e.last_name "Employee", d.department_name
"Department", e.salary "Salary", j. grade_level "Grade"
FROM employees e, departments d, job_grades j
WHERE e.department_id = d.department_id AND e.salary BETWEEN
j.lowest_sal and j.highest_sal;
(*)
True (*)
False
Create a subquery.
Create an index.
True
False (*)
Section 16
(Answer all questions in this section)
35. What would you create to make the following statement execute
faster?
SELECT *
FROM employees
WHERE LOWER(last_name) = 'chang';
A synonym
An index, either a normal or a function_based index (*)
A composite index
True (*)
False
NEXT
CURRVAL (*)
CURRENT
NEXTVAL
39. In order to be able to generate primary key values that are not
likely to contain gaps, which phrase should be included in the
sequence creation statement? Mark for Review
(1) Points
CACHE
MAXVALUE
NOCACHE (*)
The NEXTVAL virtual column returns the integer that was most
recently supplied by the sequence.
True (*)
False
REGEXP_REPLACE, REGEXP_REFORM
REGEXP_INSTR, REGEXP_SUBSTR (*)
REGEXP_LIKE, REGEXP_NEAR
An ODBC driver
47. User1 owns a table and grants select on it WITH GRANT
OPTION to User2. User2 then grants select on the same table to
User3. If User1 revokes select privileges from User2, will User3 be
able to access the table? Mark for Review
(1) Points
Yes
No (*)
Section 18
(Answer all questions in this section)
It prevents other users from querying a table while updates are being
executed on it
It prevents users from querying tables on which they have not been
granted SELECT privilege
ROLLBACK; (*)
ROLLBACK TO SAVEPOINT;
UNDO;
REVOKE;
Section 19
(Answer all questions in this section)
True
False (*)