Multiple Choice Questions - SQL Temp Tables
1. SQL Server provides two types of temp tables based on the behavior and scope of the table. These are:
A) Local Temp Table
B) Optional Temp Table
C) Global Temp Table
D) General Temp Table
2. Which one of below use less logging and are not affected by transaction rollbacks
A) table variables
B) #temp tables
C) global variables
D) None of Above
3. Temporary tables are actually created on disk in tempdb.
A) True
B) False
4. Which one of the following is correct:
A) Select * from ##temp1
B) Select * from Temporary table ##temp1
C) Select * from Temporary_table ##temp1
D) Select * from Global_Temp_tab ##temp1
5. When we are having a complex join operation then it is Not good to use temporary tables.
A) True
B) False
6. A global temporary table is defined by prefixing the table name by a ………….
A) ###
B) #
C) ##
D) None of Above
7. The temporary table is automatically dropped when the SQL connection is closed.
A) True
B) False
8. Just like views, updating data in local and global temporary tables also change the data in the underlying original tables.
A) True
B) False
9. From a performance perspective defining a temporary table and then populating it is ……….. a select ..into statement.
A) slower than
B) faster than
C) equal to
D) None of Above
10. One obvious scenario for which local temp table is useful when you have a process that needs to store intermediate results temporarily such as during the loop.
A) True
B) False
11. Temporary tables are limited to names of ...... characters.
A) 113
B) 114
C) 115
D) 116
12. Even if a thousand users, all created temporary tables with the same name, each user will only see his or her own temporary table.
A) True
B) False
Answers
1. SQL Server provides two types of temp tables based on the behavior and scope of the table. These are:
A) Local Temp Table
B) Optional Temp Table
C) Global Temp Table
D) General Temp Table
2. Which one of below use less logging and are not affected by transaction rollbacks
A) table variables
B) #temp tables
C) global variables
D) None of Above
3. Temporary tables are actually created on disk in tempdb.
A) True
B) False
4. Which one of the following is correct:
A) Select * from ##temp1
B) Select * from Temporary table ##temp1
C) Select * from Temporary_table ##temp1
D) Select * from Global_Temp_tab ##temp1
5. When we are having a complex join operation then it is Not good to use temporary tables.
A) True
B) False
6. A global temporary table is defined by prefixing the table name by a ………….
A) ###
B) #
C) ##
D) None of Above
7. The temporary table is automatically dropped when the SQL connection is closed.
A) True
B) False
8. Just like views, updating data in local and global temporary tables also change the data in the underlying original tables.
A) True
B) False
9. From a performance perspective defining a temporary table and then populating it is ……….. a select ..into statement.
A) slower than
B) faster than
C) equal to
D) None of Above
10. One obvious scenario for which local temp table is useful when you have a process that needs to store intermediate results temporarily such as during the loop.
A) True
B) False
11. Temporary tables are limited to names of ...... characters.
A) 113
B) 114
C) 115
D) 116
12. Even if a thousand users, all created temporary tables with the same name, each user will only see his or her own temporary table.
A) True
B) False
Answers