Chapter 7 Flashcards

1
Q

The SQL CREATE TABLE statement is used to name a new table and describe the table’s columns.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The SQL keyword CONSTRAINT is used to define one of five types of constraints.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The SQL keyword PRIMARY KEY is used to designate the column(s) that are the primary key for the table.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The SQL keyword CONSTRAINT is used to limit column values to specific values.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The SQL keyword CONSTRAINT is used in conjunction with the SQL keywords PRIMARY KEY and FOREIGN KEY.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

One advantage of using the CONSTRAINT command to define a primary key is that the database designer controls the name of the constraint.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

The SQL keyword UNIQUE is used to define alternative keys.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

If the table PRODUCT has a column PRICE, and PRICE has the data type Numeric (8,2), the value 98765 stored in that field will be displayed by the DBMS as 98765.00.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

If the table ITEM has a column WEIGHT, and WEIGHT has the data type Numeric (7,2), the value 4321 with be displayed by the DBMS as 43.21.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

The SQL keyword CHECK is used to limit column values to specific values.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

The SQL keyword MODIFY is used to change the structure, properties or constraints of a table.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Data values to be added to a table are specified by using the SQL VALUES clause.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

The SQL keyword DELETE is used to delete a table’s structure.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

When the correct SQL command is used to delete a table’s structure, the command can only be used with a table that has already had its data removed.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

One or more rows can be added to a table by using the SQL INSERT statement.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Unless it is being used to copy data from one table to another, the SQL INSERT statement can be used to insert only a single row into a table.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Rows in a table can be changed by using the SQL UPDATE statement.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

The SQL SET keyword is used to specify a new value when changing a column value.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

The SQL keyword MODIFY is used to change a column value.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Rows can be removed from a table by using the SQL DELETE statement.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

An SQL virtual table is called a view.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

The SQL command CREATE USER VIEW is used to create a virtual table.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q
Which SQL keyword is used to name a new table and describe the table's columns?
A) SET
B) CREATE
C) SELECT
D) ALTER
E) CONSTRAINT
A

B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q
If the table PRODUCT has a column PRICE that has the data type Numeric (8,2), the value 12345 will be displayed by the DBMS as \_\_\_\_\_\_\_\_.
A) 123.45
B) 12345
C) 12345.00
D) 123450.00
E) 00012345
A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q
Which SQL keyword is used to impose restrictions on a table, data or relationship?
A) SET
B) CREATE
C) SELECT
D) ALTER
E) CONSTRAINT
A

E

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q
One advantage of using the CONSTRAINT phrase to define a primary key is that the database designer controls the \_\_\_\_\_\_\_\_.
A) name of the primary key
B) name of the foreign key
C) name of the constraint
D) A and B
E) A, B, and C
A

C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q
The SQL keyword used to limit column values to specific values is \_\_\_\_\_\_\_\_.
A) CONSTRAINT
B) CHECK
C) NOT NULL
D) UNIQUE
E) UPDATE
A

B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q
Which SQL keyword is used to change the structure, properties or constraints of a table?
A) SET
B) CREATE
C) SELECT
D) ALTER
E) CONSTRAINT
A

D

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q
Which SQL keyword is used to delete a table's structure?
A) DELETE
B) DROP
C) DISPOSE
D) ALTER
E) MODIFY
A

B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

When the correct SQL command is used to delete a table’s structure, what happens to the data in the table?
A) If the deleted table was a parent table, the data is added to the appropriate rows of the child table.
B) If the deleted table was a child table, the data is added to the appropriate rows of the parent table.
C) The data in the table is also deleted.
D) Nothing because there was no data in the table since only an empty table can be deleted.
E) A and B

A

C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q
Which SQL keyword is used to add one or more rows of data to a table?
A) DELETE
B) INSERT
C) SELECT
D) SET
E) UPDATE
A

B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q
Which SQL keyword is used to change one or more rows in a table?
A) MODIFY
B) INSERT
C) SELECT
D) CHANGE
E) UPDATE
A

E

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q
Which SQL keyword is used to change the values of an entire column?
A) CHANGE
B) INSERT
C) SELECT
D) SET
E) MODIFY
A

D

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q
Which keyword is used to remove one or more rows from a table?
A) DELETE
B) INSERT
C) ERASE
D) SET
E) UPDATE
A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q
An SQL virtual table is called \_\_\_\_\_\_\_\_.
A) a CHECK constraint
B) a view
C) embedded SQL
D) a trigger
E) a stored procedure
A

B

36
Q
The SQL command used to create a virtual table is \_\_\_\_\_\_\_\_.
A) CREATE VTABLE
B) CREATE VIEW
C) VTABLE
D) VIEW
E) NEWLOOK
A

B

37
Q

SQL views are constructed from SELECT statements.

A

True

38
Q

According to the SQL-92, statements used to construct views cannot contain the WHERE clause.

A

False

39
Q

The SQL command SELECT is used to retrieve view instances.

A

True

40
Q

The values in an SQL view are not always changeable through the view itself.

A

True

41
Q

SQL views can be used to hide columns.

A

True

42
Q

SQL views can be used to provide a level of insulation between data processed by applications and the data actually stored in the database tables.

A

True

43
Q

If the values in an SQL view are changeable through the view itself, the SQL command UPDATE is used to change the values.

A

True

44
Q

The values in an SQL view are always changeable through the view itself.

A

False

45
Q

SQL views are updatable when the view is based on a single table with no computed columns, and all non-null columns are present in the view.

A

True

46
Q

Because SQL statements are table-oriented, whereas programs are variable-oriented, the results of SQL statements used in programs are treated as pseudofiles.

A

True

47
Q

A set of SQL statements stored in an application written in a standard programming language is called embedded SQL.

A

True

48
Q

Because SQL statements are table-oriented, whereas programs are variable-oriented, the results of SQL statements used in programs are accessed using an SQL cursor.

A

True

49
Q

A stored program that is attached to a table or view is called a stored procedure.

A

False

50
Q

SQL triggers use the ANSI SQL keywords BEFORE, INSTEAD OF, and AFTER.

A

True

51
Q

SQL triggers can be used with SQL operations INSERT, UPDATE, and DELETE.

A

True

52
Q

SQL triggers can be used when the DBMS receives an INSERT request.

A

True

53
Q

SQL triggers are used for providing default values, validity checking, updating views, and performing referential integrity actions.

A

True

54
Q

The Oracle DBMS supports the SQL BEFORE trigger.

A

True

55
Q

The SQL Server DBMS supports the SQL BEFORE trigger.

A

False

56
Q

SQL triggers can be used when the DBMS receives an insert request.

A

True

57
Q

To set a column value to an initial value that is selected according to some business logic, you would use the SQL DEFAULT constraint with the CREATE TABLE command.

A

False

58
Q

SQL triggers are created using the SQL ADD TRIGGER statement.

A

False

59
Q

If the values in an SQL view are not changeable through the view itself, you may still be able to update the view by using unique application logic. In this case, the specific logic is placed in an INSTEAD OF trigger.

A

True

60
Q

If a trigger is being written to enforce referential integrity actions, you cannot use an INSTEAD OF trigger.

A

False

61
Q

When a trigger is fired, the DBMS makes the appropriate data available to the trigger code.

A

True

62
Q

A stored program that is stored within the database and compiled when used is called a trigger.

A

False

63
Q

Stored procedures have the advantage of greater security, decreased network traffic, SQL optimized by the DBMS compiler, and code sharing.

A

True

64
Q

Unlike application code, stored procedures are never distributed to the client computers.

A

True

65
Q

Because SQL stored procedures allow and encourage code sharing among developers, stored procedures give database application developers the advantages of less work, standardized processing, and specialization among developers.

A

True

66
Q
SQL views are constructed from \_\_\_\_\_\_\_\_.
A) CREATE statements
B) INSERT statements
C) UPDATE statements
D) SELECT statements
E) VIEW statements
A

D

67
Q

According to the SQL-92, statements used to construct views cannot contain ________.
A) the SELECT clause
B) the FROM clause
C) the WHERE clause
D) the ORDER BY clause
E) SQL view statements can use all of the listed clauses.

A

D

68
Q
Which SQL statement is used to retrieve view instances?
A) CREATE
B) DELETE
C) INSERT
D) SELECT
E) UPDATE
A

D

69
Q

SQL views are used ________.
A) to hide columns
B) to show results of computed columns
C) to hide complicated SQL statements
D) to provide a level of indirection between data processed by applications and the data actually stored in the database tables
E) SQL views are used for all of the above

A

E

70
Q
If the values in an SQL view are changeable through the view itself, which SQL statement is used to change the values?
A) CREATE
B) DELETE
C) INSERT
D) SELECT
E) UPDATE
A

E

71
Q

SQL views are always updatable when ________.
A) the view is based on a single table with no computed columns, and all non-null columns are present in the view
B) the view is based on any number of tables, with or without computed columns, and the INSTEAD OF trigger is defined for the view
C) the view is based on multiple tables, the update is being done on the most subordinate table, and the rows of that table can be uniquely identified
D) A and B
E) A, B, and C

A

D

72
Q
A set of SQL statements stored in an application written in a standard programming language is called \_\_\_\_\_\_\_\_.
A) a CHECK constraint
B) a view
C) embedded SQL
D) a trigger
E) a stored procedure
A

C

73
Q
SQL statements used in programs are treated as \_\_\_\_\_\_\_\_.
A) tables
B) columns
C) rows
D) files
E) pseudofiles
A

E

74
Q
Because SQL statements are table-oriented, whereas programs are element-oriented, the results of SQL statements used in programs are accessed using \_\_\_\_\_\_\_\_.
A) standard programming tools
B) custom written programming tools
C) an SQL cursor
D) an SQL trigger
E) an SQL stored procedure
A

C

75
Q
A stored program that is attached to a table or view is called \_\_\_\_\_\_\_\_.
A) a CHECK constraint
B) a view
C) embedded SQL
D) a trigger
E) a stored procedure
A

D

76
Q
Which of the following is not an ANSI SQL trigger?
A) BEFORE UPDATE
B) INSTEAD OF UPDATE
C) BEFORE INSERT
D) INSTEAD OF CONSTRAINT
E) AFTER DELETE
A

D

77
Q
Which of the following is an SQL trigger Oracle supports?
A) BEFORE
B) INSTEAD OF
C) AFTER
D) B and C only
E) A, B, and C
A

E

78
Q
Which of the following is an SQL trigger Microsoft SQL Server supports?
A) BEFORE
B) INSTEAD OF
C) AFTER
D) B and C only
E) A, B, and C
A

D

79
Q
SQL triggers can be used when the DBMS receives a(n) \_\_\_\_\_\_\_\_ request.
A) INSERT
B) UPDATE
C) DELETE
D) A and B
E) A, B, and C
A

E

80
Q
SQL triggers are used for \_\_\_\_\_\_\_\_.
A) validity checking
B) providing default values
C) updating views
D) A and B
E) A, B, and C
A

E

81
Q
When a trigger is fired, the DBMS makes the appropriate data available to \_\_\_\_\_\_\_\_.
A) the SQL interpreter
B) the application code
C) the embedded SQL code
D) the trigger code
E) the stored procedure code
A

D

82
Q
SQL triggers are created using \_\_\_\_\_\_\_\_.
A) the SQL CREATE TRIGGER statement
B) the SQL ADD TRIGGER statement
C) the SQL TRIGGER statement
D) the SQL ADD CONSTRAINT TRIGGER statement
E) the SQL CONSTRAINT TRIGGER statement
A

A

83
Q

To set a column value to an initial value that is selected according to some business logic, you would use:
A) the SQL DEFAULT constraint with the CREATE TABLE command.
B) an SQL view.
C) embedded SQL.
D) an SQL trigger.
E) an SQL stored procedure.

A

D

84
Q

If the values in an SQL view are not changeable through the view itself, you may still be able to update the view by using unique application logic. In this case, the specific logic is placed in ________.
A) a BEFORE trigger
B) an INSTEAD OF trigger
C) an AFTER trigger
D) Depending on the specific logic, either A or B can be used.
E) Depending on the specific logic, any of A, B, or C can be used.

A

B

85
Q
A stored program that is attached to the database is called \_\_\_\_\_\_\_\_.
A) a CHECK constraint
B) a view
C) embedded SQL
D) a trigger
E) a stored procedure
A

E

86
Q
Stored procedures have the advantage of \_\_\_\_\_\_\_\_.
A) greater security
B) decreased network traffic
C) SQL optimized by the DBMS compiler
D) code sharing
E) All of the above
A

E

87
Q
Because SQL stored procedures allow and encourage code sharing among developers, stored procedures give database application developers the advantages of \_\_\_\_\_\_\_\_.
A) less work
B) standardized processing
C) specialization among developers
D) A and B
E) A, B, and C
A

E