Unit_8 Flashcards

1
Q

Stored Procedure

structures allow a single command, or a group of statements, to be executed repeatedly.

A

Looping / Loops

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

Stored Procedure

WHILE loops are commonly used with ________ to process a set of data one row at a time.

A

cursors

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

Using Loops

Three loop statements in MySQL
(W,R,L)

A

While
Repeat
Loop

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

loop checks the expression at the beginning of each iteration.

A

WHILE

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

loop is called pretest loop because it checks the expression before the statements execute.

A

WHILE

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

First, MySQL executes the statements, and then it evaluates the expression.

What loop is this?

A

REPEAT loop

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

If the expressionevaluates to FALSE, MySQL executes the statements repeatedly until the expression evaluates to TRUE.

What loop is this?

A

REPEAT Loop

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

Because this checks the statements expression after the execution of statement thefore this loop statement is also known as post-test loop

A

REPEAT Loop

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

This command specifies that the control should pass to the command immediately following the current loop.

A

BREAK command

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

In MySQL, ________ is used to exit the flow control construct that has the given label. If the label is for the outermost stored program block, ________ exits the program.

A

LEAVE

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

If you wish to terminate a single iteration of a loop you can use the ________ command.

This command immediately stops the current iteration and rechecks the loop’s condition.

A

CONTINUE

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

In MySQL, The ________ statement allows you to skip the entire code under it and start a new iteration.

Also means “start the loop again”

A

ITERATE

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

A ________ is a database object that permits the data set generated by a query to be processed one row at a time

A

cursor

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

This provides a pointer to a single row and allows the information in that row to be extracted and processed.

A

cursor

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

Commonly a ________ is combined with a ________ loop to enable row-by-row processing of an entire data set.

A

cursor, WHILE

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

True or False

cursors use resources whilst they are open and read data from the database each time a new row is fetched.

This can increase network traffic, lower the available resources of the SQL Server instance and lead to poor performance.

A

True

17
Q

A cursor cannot be used until it has been opened using the ____ statement.

A

OPEN

18
Q

Once a cursor is opened, how can you determine the number of rows it has been using?

A

@@CURSOR_ROWS

19
Q

there is only one available command that can be used to obtain a row from the cursor. This command is _____ _____

A

FETCH NEXT

20
Q

Once you have finished working with a cursor it must be closed to free the resources associated with it and to clear any locks that the cursor has created.

How will you close the cursor?

what syntax??

A

CLOSE table_name

21
Q

To release these structures and destroy the cursor after closing you should ________ it.

what syntax??

A

DEALLOCATE table_name

22
Q

if one is present, and sets a flag that specifies whether the cursor is exhausted or if further rows are present. The flag is accessed using the____________ function.

what syntax??

A

@@FETCH_STATUS

23
Q

An ____________ ________ is not affected by changes to the underlying data.

A

insensitive cursor

24
Q

These are a special type of table that, as the name suggests, are used to hold data temporarily.

A

Temporary tables

25
Q

A ____ ____ ____ is visible only to the session that it is created from and is dropped automatically when the connection is closed.

A

Local Temporary Table

26
Q

______ ______ ____ are available to all users and are automatically dropped when the last user accessing the table disconnects from the database.

A

Global Temporary Tables

27
Q

A ______ ______ provides functionality similar to a standard variable and a local temporary table combined.

A

Table Variables

28
Q

For SQL Server

What syntax do we use if we want to skip or move on to the next condition?

A

CONTINUE (keyword)

29
Q

For SQL Server

What syntax do we use if we want to exit out of the loop we use??

A

BREAK (keyword)

30
Q

For MySQL

What syntax do we use if we want to skip or move on to the next condition?

A

ITERATE (keyword) label_ofLoop

31
Q

For MySQL

What syntax do we use if we want to exit out of the loop we use??

A

LEAVE label_ofLoop