Ch. 5 Flashcards Preview

Oracle 11g SQL > Ch. 5 > Flashcards

Flashcards in Ch. 5 Deck (26):
1

Commands that modify data are called ________.

data manipulation language

2

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

INSERT

3

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

UPDATE

4

What command removes rows from a table?

DELETE

5

What command saves changed data in a table permanently?

COMMIT

6

What command allows "undoing" uncommitted changes to data?

ROLLBACK

7

What command enables setting markers in a transaction?

SAVEPOINT

8

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

LOCK TABLE

9

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

SELECT ...
FOR UPDATE

10

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.

Substitution Variable

11

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

DML

12

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

transaction

13

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

e. Both a and b are correct

14

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

d. rollback;

15

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. INSERT INTO

16

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.

c. DELETE FROM homework10;

17

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. SELECT * FROM homework10 WHERE col2 is NULL FOR UPDATE;

18

Which of the following symbols designates a substitution variable?
a. &
b. $
c. #
d. _

a. &

19

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

b. 'O''hara' (two single quotes following the O)

20

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.

b. LOCK TABLE homework10 IN EXCLUSIVE MODE;

21

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.

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

22

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.

e. all of the above

23

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. Other users can view the new orders as soon as you execute the INSERT INTO command.

24

How many rows can be added to a table by executing the INSERT INTO ....VALUES COMMAND?
a. 1
b. 2
c. 3
d. unlimited

d. unlimited

25

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.

d. None of the above restores the deleted orders.

26

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

d. none of the above