Deck 8: SQL Functions and Procedures

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

A)REGULAR
B)​LOWER
C)SMALL​
D)​LCASE
Question
Microsoft Access supports triggers.
Question
In T-SQL,arguments should have the same data type and length as the particular column in a table that they represent.
Question
To call a procedure in SQL Server,use the EXEC command.
Question
PL/SQL can process only one record at a time.
Question
In Oracle and SQL Server,the ____ function displays a value in uppercase letters.

A)CAPITAL
B)​UPPER
C)LARGE
D)​UCASE
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
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 Microsoft Access,the ____ function displays a value in uppercase letters.

A)CAPITAL
B)​LARGE
C)UPPER
D)​UCASE
Question
SQL Server uses an extended version of SQL called T-SQL or Transact-SQL.
Question
____________________ is the procedural language that SQL Server uses.
Question
To concatenate columns in Oracle,you type two ____________________ between the column names.
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 Microsoft Visual Basic,use the ____ statement to create a string variable.

A)Dim
B)​Decl
C)Var
D)​Declare
Question
Oracle uses ____________________ as an extension of SQL to accomplish procedural tasks.
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 the function UPPER(LAST_NAME),the item in parentheses (LAST_NAME)is called the ____________________ for the function.
Question
To create a stored procedure in Oracle,use the ____ command.

A)CREATE ROUTINE
B)​CREATE SCRIPT
C)CREATE PROCEDURE
D)​CREATE EXECUTABLE
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
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 computer that is connected to a network and has access through the server to the database.
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
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.

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
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
A ____ 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
The process of combining two or more character columns into a single expression is called ____________________.
Question
A(n)____________________ language is one in which you must give the computer the step-by-step process for accomplishing a task.
Question
To call a procedure in SQL Server,use the ____ command.

A)CALL
B)​RUN
C)DO
D)​EXEC
Question
What is the difference between a nonprocedural language and a procedural language? Give an example of each.
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
In Microsoft Access,programs are written in ____________________,which does not support embedded SQL commands directly in the code.
Question
To close a cursor and deactivate it,use the ____________________ command.
Question
In SQL Server,the cursor property ____________________ means that the cursor is used for retrieval purposes only.
Question
A procedure that updates data is called a(n)____________________ procedure.
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
In SQL Server,you delete a cursor by using the ____________________ command.
Question
To create a stored procedure in Oracle,use the ____________________ command.
Question
Each procedure that you create in Oracle should end with a(n)____________________.
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.
Question
A(n)____________________ is a pointer to a row in the collection of rows retrieved by an SQL command.
Question
What are the three advantages of cursors?
Question
Name two reasons for creating a stored procedure.
Question
To handle processing of errors,include a(n)____________________ clause in stored 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
The ADD_MONTHS function has one argument.
False
2
A client is a computer that is connected to a network and has access through the server to the database.
True
3
When you need to complete tasks that are beyond the capabilities of SQL,you need to use a procedural language.
True
4
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
5
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
6
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
7
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
8
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
9
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
10
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
11
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
12
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
13
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
14
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
15
In procedural languages,you can accomplish many tasks using a single command.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
16
You cannot use functions in WHERE clauses.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
17
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
18
You can embed SQL commands in Access programs similarly to the way you can in PL/SQL and T-SQL.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
19
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
20
To create a stored procedure,use the CREATE PROCEDURE command.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
21
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
22
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
23
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
24
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
25
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
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 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
28
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
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
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
31
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
32
Microsoft Access supports triggers.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
33
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
34
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
35
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
36
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
37
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
38
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
39
In Microsoft Access,the ____ function displays a value in uppercase letters.

A)CAPITAL
B)​LARGE
C)UPPER
D)​UCASE
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
____________________ 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
42
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
43
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
44
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
45
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
46
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
47
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
48
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
49
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
50
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
51
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
52
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
53
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
54
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
55
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
56
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
57
A ____ 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
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
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
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
61
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
62
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
63
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
64
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
65
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
66
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
67
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
68
In SQL Server,you delete a cursor by using the ____________________ command.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
69
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
70
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
71
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
72
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
73
What are the three advantages of cursors?
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
74
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
75
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
locked card icon
Unlock Deck
Unlock for access to all 75 flashcards in this deck.