Week 10 Flashcards

Transaction control

1
Q

The commands used to modify data is called what?

A. SQL
B. DDL
C. DML

A

C. DML (Data manipulation language)

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

Match the following commands (A-H) with their descriptions (1-8).
A. INSERT 1. Allows ‘undoing’ uncommited changes
B. UPDATE 2. Adds data to/modifies existing rows
C. DELETE 3. Add new rows to table
D. COMMIT 4. Saves changed data permanently
E. ROLLBACK 5. Prevents others from making
changes to a table
F. SAVEPOINT 6. Creates shared lock to prevent
changes in specific columns
G. LOCK TABLE 7. Sets markers in a transaction
H. SELECT…FOR UPDATE 8. Removes rows

A
A. 3
B. 2
C. 8
D. 4
E. 1
F. 7
G. 5
H. 6
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

______ must enclose nonnumeric data inserted in a column.

A. double quotes
B. single quotes
C. brackets

A

B. single quotes

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

What are the ways to insert data with missing data for a column? (select all that apply)
A. List the columns after the table and omit that column name
B. Insert the word NULL where the column would be
C. Insert 2 double quotes where the column would be
D. Insert 2 single quotes where the column would be

A

A. List the columns after the table and omit that column name
B. Insert the word NULL where the column would be
D. Insert 2 single quotes where the column would be

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

True/False: You can insert data for a virtual column.

A

False.

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

If the string you need to enter has a single quote (O’hara) what must you do for it to correctly insert into the table?

A. Make is 2 single quotes
B. Nothing
C. Put double quotes around it
D. Remove the single quote to show as a single word instead

A

A. Make is 2 single quotes

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

You can copy data from one table into another using what command?

A. COPY FROM
B. COPY INTO
C. INSERT INTO
D. INSERT FROM

A

C. INSERT INTO

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

Choose the correct function to update a row.

A. UPDATE customer (lastname)
TO ‘smith’
WHERE lastname=’jones’;

B. UPDATE customer
IN lastname = ‘smith’
WHERE lastname = ‘jones’;

C. UPDATE customer
SET lastname = ‘smith’
WHERE lastname = ‘jones’;

A

C. UPDATE customer
SET lastname = ‘smith’
WHERE lastname = ‘jones’;

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

When updating rows in a table, if the WHERE clause is missing what happens?

A. Throws an error
B. updates all rows with the table for the column
C. updates no rows in the table

A

B. updates all rows with the table for the column

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

The substitution variable is used to substitute a value in place of the variable at the time of execution. What symbol is used for this?

A. &
B. #
C. %
D. @

A

A. &

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

What command is issued to delete all records in a table?

A

DELETE FROM ;

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

True/False: An implicit COMMIT occurs if you exit the client tools or a DDL command is issued.

A

True

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

You use a _____ to create a checkpoint in a transaction where it can be rolled back to if something fails in the transaction.

A. CHECKPOINT
B. SAVEPOINT
C. BOOKMARK

A

B. SAVEPOINT

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

In a ____ lock, users can view data in a table but they cannot alter the table structure or perform other DDL operations, or make changes to the row that is locked.

A

Shared

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

If you need to place a shared lock on data you anticipate needs updating what command should you use?

A. LOCK ….FOR UPDATE
B. HOLD … FOR UPDATE
C. SELECT …. FOR UPDATE
D. Non of the above

A

C. SELECT …. FOR UPDATE

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

If you want to restrict showing results for data based on the data that is in a column, what clause do you use?

A

WHERE

17
Q

If searching for part of a string or number, what symbol do you use as a wildcard to return all values with part of the string?

A. *
B. %
C. $
D. !

A

B. %
(EX: SELECT customer
FROM Name
Where name LIKE ‘SM%’;

18
Q

True/False: You can only use the >, < , = operator types on numerical data.

A

False

19
Q

If you are looking for data in a table where the number could be 5-9, what command could you use?

A

BETWEEN
(Ex: SELECT cost
FROM Book
Where cost BETWEEN 5 AND 9;

20
Q

If you are looking for data in a table where the state is specifically CA or GA, what command could you use?

A

IN
(Ex: SELECT state
FROM customers
WHERE state IN (‘GA’ , ‘CA’);

21
Q

You use the _____ operator with wildcard characters to search for patterns.

A

LIKE

22
Q

In using the LIKE operator what does the underscore (_) mean?

A

A single character is missing or you do not care what character it is.

23
Q

To sort output in an order what command do you use?

A. ORDER BY
B. LIST BY
C. SORT BY

A

A. ORDER BY

24
Q

True/False: You cannot order by more than one column at a time.

A

False