Deck 8: SQL Functions and Procedures

Full screen (f)
exit full mode
Question
In procedural languages, you can accomplish many tasks using a single command.
Use Space or
up arrow
down arrow
to flip the card.
Question
You can embed SQL commands in Access programs similarly to the way you can in PL/SQL and T-SQL.
Question
To create a stored procedure, use the CREATE PROCEDURE command.
Question
When you anticipate running a particular query often, you can improve overall performance by saving the query in a file called a routine.
Question
In PL/SQL, procedural code appears between the BEGIN and END commands.
Question
PL/SQL, which was developed by Oracle as an extension of SQL, is an example of a procedural language.
Question
Oracle, SQL Server, and Access all use the ADD_MONTHS function to add the number of months to a date.
Question
In Access, use the & symbol to concatenate columns.
Question
To add a specific number of days to a date, you must use a function.
Question
A client is a computer that is connected to a network and has access through the server to the database.
Question
If a price is 24.95, the function ROUND(PRICE,0) would result in 24.
Question
You cannot use functions in WHERE clauses.
Question
The UPPER function allows you to manipulate numeric data.
Question
PL/SQL commands have a certain format and cannot include any blank lines in the code.
Question
The ADD_MONTHS function has one argument.
Question
You use aggregate functions to perform calculations based on groups of records.
Question
A function can have more than one argument.
Question
When you need to complete tasks that are beyond the capabilities of SQL, you need to use a procedural language.
Question
To truncate (remove) everything to the right of the decimal point, use the TRUNCATE function.
Question
In SQL Server, use the & symbol to concatenate columns.
Question
In Oracle and SQL Server, the ____ function displays a value in lowercase letters.

A) REGULAR
B) LOWER
C) SMALL
D) LCASE
Question
You can use a stored procedure to update data but not to delete data.
Question
To call a procedure in SQL Server, use the EXEC command.
Question
In Microsoft Access, the ____ function displays a value in uppercase letters.

A) CAPITAL
B) UPPER
C) LARGE
D) UCASE
Question
PL/SQL can process only one record at a time.
Question
In SQL Server, the INSERTED table is a temporary system table that contains a copy of the values that the last SQL command inserted.
Question
In Microsoft Access, you must store an SQL command in a string variable.
Question
In Oracle, to add a specific number of months to a date, use the ____ function.

A) MONTHS
B) ADD_DATE
C) ADD_MONTHS
D) CALC_MONTHS
Question
In T-SQL, all arguments start with the ampersand (&) symbol.
Question
A trigger is a pointer to a row in the collection of rows retrieved by an SQL command.
Question
DBMS_OUTPUT is a package that contains multiple procedures, including PUT_LINE.
Question
In T-SQL, arguments should have the same data type and length as the particular column in a table that they represent.
Question
In Microsoft Access, the ____ function displays a value in lowercase letters.

A) REGULAR
B) LOWER
C) SMALL
D) LCASE
Question
In SQL Server and Microsoft Access, to add a specific number of months to a date, use the ____ function.

A) MONTHS
B) DATEADD()
C) ADD_MONTHS
D) CALC_MONTHS
Question
In Oracle and SQL Server, the ____ function displays a value in uppercase letters.

A) CAPITAL
B) UPPER
C) LARGE
D) UCASE
Question
Microsoft Access supports triggers.
Question
To handle processing of errors, include an ABORT clause in a stored procedure.
Question
In Oracle and SQL Server, use the ____ function to truncate everything to the right of the decimal point.

A) TRUNCATE
B) FLOOR
C) REMOVE
D) TRIM
Question
In Oracle, SQL Server, and Microsoft Access, use the ____ function to round a numeric value to a desired number of decimal places.

A) INT
B) INTEGER
C) ROUND
D) TRUNCATE
Question
SQL Server uses an extended version of SQL called T-SQL or Transact-SQL.
Question
When you use a cursor in a procedure, the ____ command advances the cursor to the next row in the set of rows retrieved by the query and places the contents of the row in the indicated variables.

A) RETRIEVE
B) FETCH
C) GET
D) ADVANCE
Question
A(n) ____ is a procedure that is executed automatically in response to an associated database operation.

A) cursor
B) trigger
C) waypoint
D) fetchpoint
Question
The process of combining two or more character columns into a single expression is called ____________________.
Question
In Microsoft Access, you can use the ____ function to obtain today's date.

A) TODAYS_DATE
B) CURRENT_DATE
C) DATE()
D) SYSDATE
Question
To create a stored procedure in Oracle, use the ____ command.

A) CREATE ROUTINE
B) CREATE SCRIPT
C) CREATE PROCEDURE
D) CREATE EXECUTABLE
Question
Oracle uses ____________________ as an extension of SQL to accomplish procedural tasks.
Question
To remove extra spaces to the right of a value, for example, the value in a FIRST_NAME column, use the ____ function.

A) TRUNCATE
B) TRIM
C) RIGHT
D) RTRIM
Question
In SQL Server, you can use the ____ function to obtain today's date.

A) TODAYS_DATE
B) GETDATE()
C) CURRENTDATE()
D) SYSDATE
Question
In the function UPPER(LAST_NAME), the item in parentheses (LAST_NAME) is called the ____________________ for the function.
Question
A(n) ____________________ is a computer that is connected to a network and has access through the server to the database.
Question
In PL/SQL, you can ensure that a variable has the same data type as a particular column by using the ____ attribute.

A) @VARIABLE
B) %VARIABLE
C) @DATATYPE
D) %TYPE
Question
In Microsoft Visual Basic, use the ____ statement to create a string variable.

A) Dim
B) Decl
C) Var
D) Declare
Question
To concatenate columns in Oracle, you type two ____________________ between the column names.
Question
____________________ is the procedural language that SQL Server uses.
Question
Variable names in PL/SQL must start with a letter and can contain letters, dollar signs, underscores, and number signs, but cannot exceed ____ characters.

A) 15
B) 30
C) 45
D) 60
Question
To call a procedure in SQL Server, use the ____ command.

A) CALL
B) RUN
C) DO
D) EXEC
Question
A(n) ____ is a pointer to a row in the collection of rows retrieved by an SQL command.

A) cursor
B) trigger
C) waypoint
D) fetchpoint
Question
SQL is a powerful ____________________ language in which you communicate tasks to the computer using simple commands.
Question
A(n) ____________________ language is one in which you must give the computer the step-by-step process for accomplishing a task.
Question
In Oracle, you can use the ____ function to obtain today's date.

A) TODAYS_DATE
B) CURRENT_DATE
C) NOWDATE
D) SYSDATE
Question
A(n) ____________________ is a procedure that is executed automatically in response to an associated database operation, such as an INSERT, UPDATE, or DELETE command.
Question
To handle processing of errors, include a(n) ____________________ clause in stored procedure.
Question
In SQL Server, the cursor property ____________________ means that the cursor is used for retrieval purposes only.
Question
In Microsoft Access, programs are written in ____________________, which does not support embedded SQL commands directly in the code.
Question
Although Access does not support stored procedures, you can achieve some of the same convenience by creating a(n) ____________________ query that prompts the user for the arguments you would otherwise use in a stored procedure.
Question
Name two reasons for creating a stored procedure.
Question
To create a stored procedure in Oracle, use the ____________________ command.
Question
A(n) ____________________ is a pointer to a row in the collection of rows retrieved by an SQL command.
Question
A procedure that updates data is called a(n) ____________________ procedure.
Question
What are the three advantages of cursors?
Question
In SQL Server, you deactivate a cursor by using the ____________________ command.
Question
What is the difference between a nonprocedural language and a procedural language? Give an example of each.
Question
Each procedure that you create in Oracle should end with a(n) ____________________.
Question
To close a cursor and deactivate it, use the ____________________ command.
Question
When you use a cursor, the ____________________ command opens the cursor and causes the query to be executed, making the results available to the procedure.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/75
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 8: SQL Functions and Procedures
1
In procedural languages, you can accomplish many tasks using a single command.
False
2
You can embed SQL commands in Access programs similarly to the way you can in PL/SQL and T-SQL.
False
3
To create a stored procedure, use the CREATE PROCEDURE command.
True
4
When you anticipate running a particular query often, you can improve overall performance by saving the query in a file called a routine.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
5
In PL/SQL, procedural code appears between the BEGIN and END commands.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
6
PL/SQL, which was developed by Oracle as an extension of SQL, is an example of a procedural language.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
7
Oracle, SQL Server, and Access all use the ADD_MONTHS function to add the number of months to a date.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
8
In Access, use the & symbol to concatenate columns.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
9
To add a specific number of days to a date, you must use a function.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
10
A client is a computer that is connected to a network and has access through the server to the database.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
11
If a price is 24.95, the function ROUND(PRICE,0) would result in 24.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
12
You cannot use functions in WHERE clauses.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
13
The UPPER function allows you to manipulate numeric data.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
14
PL/SQL commands have a certain format and cannot include any blank lines in the code.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
15
The ADD_MONTHS function has one argument.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
16
You use aggregate functions to perform calculations based on groups of records.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
17
A function can have more than one argument.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
18
When you need to complete tasks that are beyond the capabilities of SQL, you need to use a procedural language.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
19
To truncate (remove) everything to the right of the decimal point, use the TRUNCATE function.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
20
In SQL Server, use the & symbol to concatenate columns.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
21
In Oracle and SQL Server, the ____ function displays a value in lowercase letters.

A) REGULAR
B) LOWER
C) SMALL
D) LCASE
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
22
You can use a stored procedure to update data but not to delete data.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
23
To call a procedure in SQL Server, use the EXEC command.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
24
In Microsoft Access, the ____ function displays a value in uppercase letters.

A) CAPITAL
B) UPPER
C) LARGE
D) UCASE
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
25
PL/SQL can process only one record at a time.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
26
In SQL Server, the INSERTED table is a temporary system table that contains a copy of the values that the last SQL command inserted.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
27
In Microsoft Access, you must store an SQL command in a string variable.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
28
In Oracle, to add a specific number of months to a date, use the ____ function.

A) MONTHS
B) ADD_DATE
C) ADD_MONTHS
D) CALC_MONTHS
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
29
In T-SQL, all arguments start with the ampersand (&) symbol.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
30
A trigger is a pointer to a row in the collection of rows retrieved by an SQL command.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
31
DBMS_OUTPUT is a package that contains multiple procedures, including PUT_LINE.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
32
In T-SQL, arguments should have the same data type and length as the particular column in a table that they represent.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
33
In Microsoft Access, the ____ function displays a value in lowercase letters.

A) REGULAR
B) LOWER
C) SMALL
D) LCASE
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
34
In SQL Server and Microsoft Access, to add a specific number of months to a date, use the ____ function.

A) MONTHS
B) DATEADD()
C) ADD_MONTHS
D) CALC_MONTHS
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
35
In Oracle and SQL Server, the ____ function displays a value in uppercase letters.

A) CAPITAL
B) UPPER
C) LARGE
D) UCASE
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
36
Microsoft Access supports triggers.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
37
To handle processing of errors, include an ABORT clause in a stored procedure.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
38
In Oracle and SQL Server, use the ____ function to truncate everything to the right of the decimal point.

A) TRUNCATE
B) FLOOR
C) REMOVE
D) TRIM
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
39
In Oracle, SQL Server, and Microsoft Access, use the ____ function to round a numeric value to a desired number of decimal places.

A) INT
B) INTEGER
C) ROUND
D) TRUNCATE
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
40
SQL Server uses an extended version of SQL called T-SQL or Transact-SQL.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
41
When you use a cursor in a procedure, the ____ command advances the cursor to the next row in the set of rows retrieved by the query and places the contents of the row in the indicated variables.

A) RETRIEVE
B) FETCH
C) GET
D) ADVANCE
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
42
A(n) ____ is a procedure that is executed automatically in response to an associated database operation.

A) cursor
B) trigger
C) waypoint
D) fetchpoint
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
43
The process of combining two or more character columns into a single expression is called ____________________.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
44
In Microsoft Access, you can use the ____ function to obtain today's date.

A) TODAYS_DATE
B) CURRENT_DATE
C) DATE()
D) SYSDATE
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
45
To create a stored procedure in Oracle, use the ____ command.

A) CREATE ROUTINE
B) CREATE SCRIPT
C) CREATE PROCEDURE
D) CREATE EXECUTABLE
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
46
Oracle uses ____________________ as an extension of SQL to accomplish procedural tasks.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
47
To remove extra spaces to the right of a value, for example, the value in a FIRST_NAME column, use the ____ function.

A) TRUNCATE
B) TRIM
C) RIGHT
D) RTRIM
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
48
In SQL Server, you can use the ____ function to obtain today's date.

A) TODAYS_DATE
B) GETDATE()
C) CURRENTDATE()
D) SYSDATE
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
49
In the function UPPER(LAST_NAME), the item in parentheses (LAST_NAME) is called the ____________________ for the function.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
50
A(n) ____________________ is a computer that is connected to a network and has access through the server to the database.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
51
In PL/SQL, you can ensure that a variable has the same data type as a particular column by using the ____ attribute.

A) @VARIABLE
B) %VARIABLE
C) @DATATYPE
D) %TYPE
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
52
In Microsoft Visual Basic, use the ____ statement to create a string variable.

A) Dim
B) Decl
C) Var
D) Declare
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
53
To concatenate columns in Oracle, you type two ____________________ between the column names.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
54
____________________ is the procedural language that SQL Server uses.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
55
Variable names in PL/SQL must start with a letter and can contain letters, dollar signs, underscores, and number signs, but cannot exceed ____ characters.

A) 15
B) 30
C) 45
D) 60
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
56
To call a procedure in SQL Server, use the ____ command.

A) CALL
B) RUN
C) DO
D) EXEC
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
57
A(n) ____ is a pointer to a row in the collection of rows retrieved by an SQL command.

A) cursor
B) trigger
C) waypoint
D) fetchpoint
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
58
SQL is a powerful ____________________ language in which you communicate tasks to the computer using simple commands.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
59
A(n) ____________________ language is one in which you must give the computer the step-by-step process for accomplishing a task.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
60
In Oracle, you can use the ____ function to obtain today's date.

A) TODAYS_DATE
B) CURRENT_DATE
C) NOWDATE
D) SYSDATE
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
61
A(n) ____________________ is a procedure that is executed automatically in response to an associated database operation, such as an INSERT, UPDATE, or DELETE command.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
62
To handle processing of errors, include a(n) ____________________ clause in stored procedure.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
63
In SQL Server, the cursor property ____________________ means that the cursor is used for retrieval purposes only.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
64
In Microsoft Access, programs are written in ____________________, which does not support embedded SQL commands directly in the code.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
65
Although Access does not support stored procedures, you can achieve some of the same convenience by creating a(n) ____________________ query that prompts the user for the arguments you would otherwise use in a stored procedure.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
66
Name two reasons for creating a stored procedure.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
67
To create a stored procedure in Oracle, use the ____________________ command.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
68
A(n) ____________________ is a pointer to a row in the collection of rows retrieved by an SQL command.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
69
A procedure that updates data is called a(n) ____________________ procedure.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
70
What are the three advantages of cursors?
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
71
In SQL Server, you deactivate a cursor by using the ____________________ command.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
72
What is the difference between a nonprocedural language and a procedural language? Give an example of each.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
73
Each procedure that you create in Oracle should end with a(n) ____________________.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
74
To close a cursor and deactivate it, use the ____________________ command.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
75
When you use a cursor, the ____________________ command opens the cursor and causes the query to be executed, making the results available to the procedure.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 75 flashcards in this deck.