Ch. 5 Flashcards

1
Q

Commands that modify data are called ________.

A

data manipulation language

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

What command adds new rose to a table; can include a subquery to copy rows from an existing table?

A

INSERT

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

What command adds data to, or modifies data in, existing rows?

A

UPDATE

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

What command removes rows from a table?

A

DELETE

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

What command saves changed data in a table permanently?

A

COMMIT

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

What command allows “undoing” uncommitted changes to data?

A

ROLLBACK

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

What command enables setting markers in a transaction?

A

SAVEPOINT

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

What command prevents other users from making changes to a table?

A

LOCK TABLE

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

What command creates a shared lock on a table to prevent another user from making changes to data in specified columns?

A

SELECT …

FOR UPDATE

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

A _______ ________ in an SQL command instructs Oracle 11g to substitute a value in place of the variable at the time the command is actually executed.

A

Substitution Variable

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

All ______ commands you execute remain in a transaction queue until you save the actions permanently or undo the actions.

A

DML

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

A ______ is a term used to describe DML statements representing data actions that should logically be performed together.

A

transaction

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

Which of the following is a correct statement?

a. A commit is issued implicitly when a user exits SQL developer or SQL*Plus.
b. A commit is issued implicitly when a DDL command is executed.
c. A commit is issued automatically when a DML command is executed.
d. All of the above are correct.
e. Both a and b are correct
f. Both a and c are correct

A

e. Both a and b are correct

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

Which of the following is a valid SQL statement?

a. SELECT * WHERE amid = ‘J100’ FOR UPDATE;
b. INSERT INTO homework10 VALUES (SELECT * FROM acctmanager);
c. DELETE amid FROM acctmanager;
d. rollback;
e. all of the above

A

d. rollback;

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

Which of the following commands can be used to add rows to a table?

a. INSERT INTO
b. ALTER TABLE ADD
c. UPDATE
d. SELECT ….. FOR UPDATE

A

a. INSERT INTO

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

Which of the following statements deletes all rows in the HOMEWORK10 table?

a. DELETE * FROM homework10;
b. DELETE . FROM homework10;
c. DELETE FROM homework10;
d. DELETE FROM homework10 WHERE amid = (*);
e. Both c and d delete all rows in the HOMEWORK10 table.

A

c. DELETE FROM homework10;

17
Q

Which of the following statements places a shared lock on at least a portion of a table named HOMEWORK10?

a. SELECT * FROM homework10 WHERE col2 is NULL FOR UPDATE;
b. INSERT INTO homework10 (col1, col2, col3) VALUES (‘A’, ‘B’, ‘C’);
c. UPDATE homework10 SET col3 = NULL WHERE col1 = ‘A’;
d. UPDATE homework10 SEL col3 = LOWER (col3) WHERE col1= ‘A’;
e. all of the above

A

a. SELECT * FROM homework10 WHERE col2 is NULL FOR UPDATE;

18
Q

Which of the following symbols designates a substitution variable?

a. &
b. $
c. #
d. _

A

a. &

19
Q

Which of the following input values results in a successful INSERT of O’hara?

a. ‘O^hara’
b. ‘O’‘hara’ (two single quotes following the O)
c. ‘O”para’ ( a double quote following the O)
d. Data values can’t contain quotes

A

b. ‘O’‘hara’ (two single quotes following the O)

20
Q

Which of the following commands locks the HOMEWORK10 table in EXCLUSIVE mode?

a. LOCK TABLE homework10 EXCLUSIVELY;
b. LOCK TABLE homework10 IN EXCLUSIVE MODE;
c. LOCK TABLE homework10 TO OTHERS USERS;
d. LOCK homework10 IN EXCLUSIVE MODE;
e. Both b and d lock the table in EXCLUSIVE mode.

A

b. LOCK TABLE homework10 IN EXCLUSIVE MODE;

21
Q

You issue the following command: INSERT INTO homework10 (col1, col2, col3) VALUES (‘A’, NULL, ‘C’). The command will fail if which of the following statements is true?

a. Col1 has a PRIMARY KEY constraint enabled
b. Col2 has a UNIQUE constraint enabled.
c. COL3 is defined as a DATE column
d. None of the above would cause the command to fail.

A

d. None of the above would cause the command to fail.

22
Q

Which of the following releases a lock currently held by a user on the HOMEWORK10 table?

a. A COMMIT command is issued.
b. A DDL command is issued to end a transaction.
c. The user exits the system
d. A ROLLBACK command is issued.
e. all of the above
f. none of the above.

A

e. all of the above

23
Q

Assume you have added eight new orders to the ORDERS table. Which of the following is true?

a. Other users can view the new orders as soon as you execute the INSERT INTO command.
b. Other users can view the new orders as soon as you issue a ROLLBACK command.
c. Other users can view the new orders as soon as you exit the system or execute a COMMIT command.
d. Other users can view the new orders only if they place an exclusive lock on the table.

A

a. Other users can view the new orders as soon as you execute the INSERT INTO command.

24
Q

How many rows can be added to a table by executing the INSERT INTO ….VALUES COMMAND?

a. 1
b. 2
c. 3
d. unlimited

A

d. unlimited

25
Q

You accidentally deleted all the orders in the ORDERS table. How can the error be corrected after a COMMIT command has been issued?

a. ROLLBACK;
b. ROLLBACK COMMIT;
c. REGENERATE RECORDS orders;
d. None of the above restores the deleted orders.

A

d. None of the above restores the deleted orders.

26
Q

A rollback occurs automatically when:

a. A DDL command is executed
b. A DML command is executed
c. The user exits the system
d. none of the above

A

d. none of the above