wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

AIT 524 SQL Chapter 13

Total questions: 105

Worksheet time: 52mins

Name
Class
Date
1.
Views can be used to restrict a user's access to sensitive data.
a)
true
b)
false
2.
​A view can be created to simplify issuing complex SQL queries.
a)
true
b)
false
3.
Views are database objects that store data.​
a)
true
b)
false
4.
Views are not database objects.​
a)
true
b)
false
5.
A view name must be enclosed in single quotation marks if it is referenced in the FROM clause of a SELECT statement.​
a)
true
b)
false
6.
A simple view is based upon a subquery that references only one table and doesn't contain any group functions, expressions, or a GROUP BY clause.​
a)
true
b)
false
7.
A complex view cannot contain any group functions.​
a)
true
b)
false
8.
A complex view can retrieve data from more than one table.​
a)
true
b)
false
9.
An inline view is a temporary table that only lasts for the duration of the SELECT statement used to create it.​
a)
true
b)
false
10.
A view can be modified using the MODIFY clause of the ALTER VIEW command.​
a)
true
b)
false
11.
You cannot create a view if the underlying table does not exist at the time the view is created.​
a)
true
b)
false
12.
A view cannot be given the same name as another database object.​
a)
true
b)
false
13.
The column names used in the view must be the same names as the column names in the underlying table(s).​
a)
true
b)
false
14.
Column aliases can be used in the subquery to assign new column names to the columns contained in a view.​
a)
true
b)
false
15.
The WITH READ ONLY option can be used to prevent changes from being made to the data displayed by the view.​
a)
true
b)
false
16.
A simple view cannot contain a simple arithmetic operation.​
a)
true
b)
false
17.
Any DML operation can be performed on a simple view that was not created with the WITH READ ONLY option, unless it violates an existing constraint.​
a)
true
b)
false
18.
Rows cannot be added to a simple view.​
a)
true
b)
false
19.
Rows can be updated through a simple view as long as the operation does not violate existing constraints and the view was created with the WITH READ ONLY option.​
a)
true
b)
false
20.
DML operations can be performed through a simple view even if the operation will violate constraints on the underlying table.​
a)
true
b)
false
21.
Rows can be deleted through a simple view as long as the operation does not violate existing constraints and the view was created with the WITH READ ONLY option.​
a)
true
b)
false
22.
Update operations cannot be performed through a complex view that contains an arithmetic expression.​
a)
true
b)
false
23.
Rows in an underlying table cannot be deleted through a complex view that contains an arithmetic operation.​
a)
true
b)
false
24.
Values cannot be inserted through a view into columns that are based on arithmetic expressions.​
a)
true
b)
false
25.
When a view includes columns from more than one table, updates can only be applied to the table that includes the primary key for the view.​
a)
true
b)
false
26.
DML operations cannot be performed on a key-preserved table.​
a)
true
b)
false
27.
Rows can be added through a complex view that is based upon grouped data.​
a)
true
b)
false
28.
DML operations can be performed on a view created with the DISTINCT keyword.​
a)
true
b)
false
29.
An ORDER BY clause can be used to perform "TOP-N" analysis.​
a)
true
b)
false
30.
"TOP-N" analysis is performed by sorting values in ascending or descending order in an inline view.​
a)
true
b)
false
31.
A(n) view is a database object, but it does not actually store data.
a)
true
b)
false
32.
A view can be thought of as the result of a(n) stored query.
a)
true
b)
false
33.
A(n) simple view can contain a GROUP BY clause.
a)
true
b)
false
34.
An inline view is used to create a(n) permanent table.
a)
true
b)
false
35.
A(n) existing view cannot be modified.
a)
true
b)
false
36.
The NOFORCE keyword can be used to create a view based upon a table that has not yet been created.
a)
true
b)
false
37.
FORCE is the default mode for the CREATE VIEW command.
a)
true
b)
false
38.
The WITH CHECK OPTION can be used when a view is created to ensure that any DML operations performed on the view will not prevent the row from being accessible by the view at a later time.
a)
true
b)
false
39.
The WITHOUT UPDATE keywords prevent DML operations from being performed through a view.
a)
true
b)
false
40.
When a query references a view, the query in the view is processed, and the results are treated as a(n) permanent table.
a)
true
b)
false
41.
The OR REPLACE clause is only necessary if another view may already exist with the same name.
a)
true
b)
false
42.
The UPDATE command cannot be used on a view created with the WITH CHECK OPTION.
a)
true
b)
false
43.
Any DDL operation can be performed on a simple view that was not created with the WITH READ ONLY option, unless it violates an existing constraint.
a)
true
b)
false
44.
A(n) complex view can contain data from more than one table.
a)
true
b)
false
45.
A(n) UPDATE operation can be performed on a complex view that contains an arithmetic operation.
a)
true
b)
false
46.
The DELETE operation can be performed through a complex view that contains an arithmetic operation.
a)
true
b)
false
47.
DML operations cannot be performed on non key-preserved tables through a complex view.
a)
true
b)
false
48.
Rows cannot be added to a table through a complex view that was created with the ORDER BY clause.
a)
true
b)
false
49.
Rows cannot be deleted from a table through a complex view that is based on a group function.
a)
true
b)
false
50.
Rows cannot be added to a table through a complex view that is based on a group function.
a)
true
b)
false
51.
Rows cannot be deleted if the complex view was created with a(n) GROUP BY clause.
a)
true
b)
false
52.
A view can be dropped or deleted using the DELETE VIEW command.
a)
true
b)
false
53.
An inline analysis can be used to find the “Top-N” values.
a)
true
b)
false
54.
The pseudo column ROW can be used to perform a "TOP-N" analysis.
a)
true
b)
false
55.
"TOP-N" analysis can be used to find the highest values in a column by sorting the data in ascending order.
a)
true
b)
false
56.
A(n) ____ stores a query and is used to access data in the underlying tables.​
a)
view
b)
constraint
c)
function
d)
argument
57.
Which of the following statements about views is incorrect?​
a)
​Views assist users who do not have the training to issue complex SQL inquiries.
b)
​Views restrict users' access to sensitive data.
c)
​Views are database objects that actually store data.
d)
A view can be referenced in a SELECT...FROM statement, just like any table.
58.
Which of the following describes a subquery used in a FROM clause to create a "temporary" table that can be referenced by the SELECT and WHERE clauses of the outer query?​
a)
simple view
b)
complex view
c)
inline view
d)
"TOP-N" analysis
59.
Which of the following describes a type of view that is based on a subquery that retrieves or derives data from one or more tables, and may also contain functions or grouped data?​
a)
simple view
b)
complex view
c)
inline view
d)
"TOP-N" analysis
60.
Which of the following describes a type of view that is based upon a subquery that only references one table and does not include any group functions, expressions, or GROUP BY clauses?​
a)
simple view
b)
complex view
c)
inline view
d)
"TOP-N" analysis
61.
Which of the following types of views cannot include a group function?
a)
simple view
b)
inline view
c)
complex view
d)
all apply
62.
Which of the following types of views cannot include a GROUP BY clause?​
a)
simple view
b)
inline view
c)
complex view
d)
all apply
63.
Which of the following types of views cannot include an arithmetic expression?​
a)
simple view
b)
inline view
c)
complex view
d)
all apply
64.
Which of the following statements is incorrect?​
a)
​A view can be created with the CREATE VIEW command.
b)
​Views can be modified by using the ALTER VIEW...
c)
A view cannot be modified; if you need to change it, you must use the CREATE OR REPLACE VIEW keywords.
d)
​A view cannot be given the same name as another database object in the same schema.
65.
If you want to create a view based upon a table or tables that do not yet exist, or are currently unavailable (e.g.,off-line), what keyword can you use to avoid receiving an error message?​
a)
FORCE
b)
NOERROR
c)
OVERRIDE
d)
none apply
66.
What is the default mode for the CREATE VIEW command?​
a)
COMPILE
b)
NOCOMPILE
c)
FORCE
d)
NOFORCE
67.

Which type of view is created with the following command?

CREATE VIEW inventory

AS SELECT isbn, title, retail price

FROM books

WITH READ ONLY;

a)

simple

b)

complex

c)

derived

d)

inline

68.
What is the procedure for assigning new names for the columns that are displayed by a view?​
a)
​The new column names can be listed after the VIEW keyword, enclosed in parentheses.
b)
​Column aliases can be used in the subquery, and Oracle12c will use the aliases as column names in the view that is created.
c)
both apply
d)
neither apply
69.
Which of the following types of views cannot contain grouped data?​
a)
simple
b)
complex
c)
inline view
d)
all apply
70.
____ aren’t allowed in the CREATE VIEW command.​
a)
​Arithmetic expressions
b)
​ORDER BY clauses
c)
​Group functions
d)
​GROUP BY clauses
71.
The ____ constraint ensures that any DML operations performed on the view (e.g., adding rows, changing data) will not prevent the row from being accessed by the view because it no longer meets the condition in the WHERE clause.​
a)
ON UPDATE CHECK
b)
WITH CHECK OPTION
c)
WITH READ ONLY
d)
READ-WRITE ONLY
72.
Which constraint ensures that the data in a view cannot be changed?​
a)
​WITH CHECK OPTION
b)
​WITH READ OPTION
c)
​WITH READ ONLY
d)
​NO WRITE OPTION
73.

Which statement is true about the view created with the following command?

CREATE VIEW inventory AS SELECT isbn, title, retail price

FROM books

WITH READ ONLY;

a)

​The command creates a simple view.

b)

​DML operations are NOT allowed on the data displayed by the view.

c)

​A view named INVENTORY did not previously exist.

d)

all apply

74.

Which statement is not true about the view created with the following command?


CREATE VIEW inventory

AS SELECT isbn, title, retail price

FROM books;

a)

​The command creates a simple view.

b)

​DML operations are not allowed on the data displayed by the view.

c)

​A view named INVENTORY did not previously exist.

d)

all apply

75.
The OR REPLACE clause is not required if ____.​
a)
​another view does not exist with the same name
b)
​the view is not based on a group function
c)
​the view does not contain data from more than one table
d)
​the CREATE command does not specify the WITH CHECK OPTION option
76.

Which type of view is created with the following command?


CREATE VIEW OR REPLACE outstanding

AS SELECT customer#, order#, orderdate, shipdate

FROM orders

WHERE shipdate IS NULL

WITH READ ONLY;

a)

simple

b)

complex

c)

derived

d)

inline

77.

Which statement is true about the view created with the following command?


CREATE OR REPLACE VIEW outstanding

AS SELECT customer#, order#, orderdate, shipdate

FROM orders

WHERE shipdate IS NULL

WITH READ ONLY;

a)

​The order# of an order cannot be changed through the view.

b)

​The shipping date of an order cannot be changed through the view.

c)

​No DML operations are permitted through the view.

d)

all apply

78.
Which of the following options will prevent any DML operations from being performed on the underlying table of a view?​
a)
WITH READ ONLY
b)
WITH CHECK ONLY
c)
WITH CHECK OPTION
d)
NO WRITE OPTION
79.

Which statement is true about the view created with the following command?


CREATE OR REPLACE VIEW inventory

AS SELECT isbn, title, retail price

FROM books;

a)

​The command creates a complex view.

b)

​DML operations are not allowed on the data displayed by the view.

c)

​A database object named INVENTORY may already exist.

d)

all apply

80.
A user can perform a DML operation (add, modify, delete) on a simple view if it does not violate which type of existing constraint on the underlying base table?​
a)
PRIMARY KEY
b)
WITH CHECK OPTION
c)
UNIQUE
d)
all apply
81.
If a view was created with the WITH READ ONLY constraint, to remove the constraint you will need to ____.​
a)
​use the ALTER VIEW command
b)
​re-create the view without the option
c)
drop the option
82.

Which statement is true about the view created with the following command?


CREATE VIEW outstanding

AS SELECT customer#, order#, orderdate, shipdate

FROM orders

WHERE shipdate IS NULL

WITH CHECK OPTION;

a)

​The order# of an order cannot be changed through the view.

b)

​The shipping date of an order cannot be changed through the view.

c)

​No DML operations are permitted through the view.

d)

none apply

83.

Which type of view is created with the following command?


CREATE VIEW outstanding

AS SELECT customer#, order#, orderdate, shipdate

FROM orders

WHERE shipdate IS NULL

WITH CHECK OPTION;

a)

complex

b)

partial

c)

simple

d)

none apply

84.
If a view was created with the WITH CHECK OPTION constraint, to remove the constraint you will need to ____.​
a)
use the ALTER VIEW command
b)
re-create the view without the option
c)
rename the view
d)
drop the option
85.
Which of the following statements about complex views is incorrect?​
a)
​It is created with the same CREATE VIEW command as a simple view.
b)
​It retrieves or derives data from one or more tables.
c)
​All DML operations can be performed on complex views, just like simple views.
d)
​It may contain functions or grouped data.
86.
A view based on the contents of one table that uses an expression for one of the columns is considered a(n) ____ view.​
a)
simple
b)
complex
c)
inline
d)
outer
87.

Which statement is true about the view created with the following command?


CREATE VIEW OR REPLACE outstanding

AS SELECT customer#, order#, orderdate, shipdate

FROM orders

WHERE shipdate IS NULL;

a)

The order# of an order can be changed through the view.

b)

The shipping date of an order can be changed through the view.

c)

​A new order can be added through the view as long as no constraints on the underlying table are violated.

d)

all apply

88.

Which type of view is created by the following command?


CREATE VIEW OR REPLACE outstanding

AS SELECT customer#, order#, orderdate, shipdate

FROM orders

WHERE shipdate IS NULL;

a)

simple

b)

complex

c)

inline

d)

none apply

89.

Which statement about the view created from the following command is correct, assuming no constraints exist on the underlying table?


CREATE VIEW prices

AS SELECT isbn, title, cost, retail, retail-cost profit

FROM books;

a)

The retail price of a book can be changed.

b)

The profit generated by a book can be changed.

c)

The profit generated by a book can be added.

d)

​Values for a new book can be added for all five columns displayed by the view.

90.

Which type of view is created from the following command?


CREATE VIEW prices

AS SELECT isbn, title, cost, retail, retail-cost profit

FROM books;

a)

simple

b)

inline

c)

complex

d)

derived

91.
Which of the following statements about performing DML operations on complex views is correct?​
a)
Values cannot be inserted into columns containing date data.
b)
​Values cannot be inserted into columns that are based on arithmetic expressions.
c)
​Values cannot be inserted into columns containing an ORDER BY clause.
92.

Which SQL statement can be executed based upon the view created from the following command, assuming no constraints exist on the underlying table?


CREATE VIEW prices

AS SELECT isbn, title, cost, retail, retail-cost profit

FROM books;

a)

INSERT INTO prices (title, cost, retail, profit)

VALUES ('A NEW BOOK', 49.99, 69.99, 20);

b)

INSERT INTO prices (title, cost, retail, profit)

VALUES ('A SECOND BOOK', 49.99, 39.99, -10);

c)

INSERT INTO prices (title, cost, retail)

VALUES ('A NEW BOOK', 49.99, 69.99);

d)

none apply

93.

Which type of view is created from the following SQL command?

CREATE OR REPLACE VIEW prices

AS SELECT isbn, title, cost, retail, retail-cost profit, name

FROM books NATURAL JOIN publisher;

a)

complex

b)

simple

c)

inline

d)

none apply

94.

Which statement about the view created from the following SQL command is correct, assuming ISBN from the BOOKS table is the primary key used by the view?


CREATE OR REPLACE VIEW prices

AS SELECT isbn, title, cost, retail, retail-cost profit, name

FROM books NATURAL JOIN publisher;

a)

​DML operations can only be performed on the columns belonging to the PUBLISHER table.

b)

No DML operations are allowed.​

c)

​DML operations are allowed on both the BOOKS and PUBLISHER tables.

d)

​DML operations can only be performed on the columns belonging to the BOOKS table.

95.

A(n) ____ table is the table that contains the primary key the view uses to uniquely identify each record being displayed by the view.​

a)

non key-preserved

b)

key-preserved

c)

primary

d)

non primary-keyed

96.

A(n) ____ table is a table that does not contain the primary key that a view uses to uniquely identify each record being displayed by the view.​

a)

non key-preserved

b)

key-preserved

c)

primary

d)

non primary-keyed

97.

Which of the following statements about performing DML operations on complex views is correct?​

a)

​DML operations cannot be performed on a non primary key-locked table

b)

​DML operations cannot be performed on a non key-preserved table.

c)

​DML operations can be performed if a view contains a group function or a GROUP BY clause.

d)

none apply

98.

Which statement about the view created from the following SQL statement is correct?


CREATE VIEW balancedue AS SELECT customer#, order#, SUM(quantity*retail) amtdue

FROM customers NATURAL JOIN orders NATURAL JOIN orderitems NATURAL JOIN books GROUP BY customer#, order#;

a)

​No DML operations can be performed through the view.

b)

​DML operations can only be performed on the CUSTOMERS table since it is the primary key for the view.

c)

​Only rows can be added through the view — no other DML operations are allowed.

d)

none apply

99.

Which type of view is created from the following SQL statement?


CREATE VIEW balancedue

AS SELECT customer#, order#, SUM(quantity*retail) amtdue

FROM customers NATURAL JOIN orders NATURAL JOIN

orderitems NATURAL JOIN books

GROUP BY customer#, order#;

a)

simple

b)

complex

c)

inline

d)

partial

100.

DML operations are not allowed on a view that is created with the ____ keyword.​

a)

JOIN

b)

NATURAL JOIN

c)

DISTINCT

d)

REPLACE

101.

DML operations are not allowed on a view that includes the pseudo column ____.​

a)

ROWNUMBER

b)

DISTINCTROW

c)

ROWNUM

d)

NUMROW

102.

​Which command will delete a view?

a)

ALTER TABLE...DROP VIEW

b)

DROP VIEW

c)

ALTER TABLE...DELETE VIEW

d)

DELETE VIEW

103.

What is the definition of an inline view?​

a)

​It is a permanent database object that can be referenced by subsequent queries.

b)

​It is a view that retrieves data from one or more tables, and can contain functions and grouped data.

c)

​It is a temporary data source that exists only while a command is being executed.

d)

​It is a temporary pseudo column.

104.

The type of view that actually replicates data is called a(n) ____ view.​

a)

simple

b)

complex

c)

inline

d)

materialized

105.

The subquery used to create a(n) ____ view can contain an ORDER BY clause.​

a)

simple

b)

complex

c)

derived

d)

inline