70-461 Querying Microsoft SQL Server 2012

70-461 Querying Microsoft SQL Server 2012

memorize.aimemorize.ai (lvl 286)
Section 1

Preview this deck

What two constraints, by default, cause an index to be created?

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (214)

Section 1

(50 cards)

What two constraints, by default, cause an index to be created?

Front

PRIMARY KEY and UNIQUE

Back

What is the maximum depth level for nested triggers?

Front

32 levels

Back

Which type of trigger is executed in place of the statement that fires it, but before any table constraints are checked?

Front

An INSTEAD OF trigger

Back

Against which two database object types can you define an INSTEAD OF trigger?

Front

tables and views

Back

In what situation can a function be used to execute the required programming logic?

Front

If there is exactly one value returned, but not as a parameter

Back

Which TSQL command allows you to establish the database to which you are connected?

Front

The USE command

Back

What type of trigger runs in place of the INSERT, UPDATE, or DELETE statement that fired it?

Front

INSTEAD OF triggers

Back

Which clause determines the order of characters in a character set during sort and comparison operations?

Front

COLLATE clause

Back

When you execute an AFTER DELETE trigger, which system table will contain the rows and the values they contained before they were deleted?

Front

the deleted system table

Back

What logical concept defines a "missing value" in a relational database?

Front

NULL

Back

What is a user-defined function that returns a single simple value?

Front

a scalar UDF

Back

Which clause can be used with the CREATE FUNCTION statement to ensure that objects referenced by the new function cannot be altered or dropped until the function is altered or dropped?

Front

The WITH SCHEMABINDING clause

Back

Which clause in a foreign key constraint allows you to delete a row from the parent table and maintains referential integrity by deleting all of the corresponding child rows of that parent?

Front

ON DELETE CASCADE

Back

Which five steps must you perform to pass a table-valued variable to a user-defined stored procedure?

Front

Create a user-defined data type, create the stored procedure that accepts a table parameter, declare a variable of the user-defined data type, initialize the variable, and pass the variable as an input parameter to the stored procedure

Back

What does the expression COUNT(*) mean when used in a SQL SELECT statement?

Front

Count the number of rows

Back

Which database object would you create to accept input parameters and execute Transact-SQL code without returning a value?

Front

A stored procedure

Back

Which user privilege is required to view the metadata for views stored in the system tables?

Front

VIEW DEFINITION

Back

Which two optional words can enclose your declarations and executable code in a procedure?

Front

BEGIN and END

Back

What is the term for the various business rules on the columns of a table which control data integrity?

Front

constraints

Back

Which T-SQL statement can you include in the code of the trigger to indicate a normal exit from the trigger?

Front

RETURN

Back

What supplied function is used for converting data types?

Front

CAST

Back

What privilege is required for a developer to create a UDF?

Front

the CREATE FUNCTION privilege

Back

Which T-SQL data type is used to process one row at a time in a result set?

Front

A cursor

Back

On what type of database object can you define an AFTER trigger?

Front

A table

Back

What is the name of the DML trigger that fires following the triggering event?

Front

AFTER

Back

What object allows users access to only certain columns and certain rows of a given table?

Front

a view

Back

If a DML trigger fires and executes another DML statement also contains a trigger, what will happen to that second trigger?

Front

The second trigger will fire

Back

What command explicitly fires a trigger?

Front

None. A trigger is implicitly fired when the triggering event occurs.

Back

What is the requirement regarding the columns of multiple tables which are combined together using one of the SET operators?

Front

The number and datatype of the columns must be the same for all of the tables in the statement.

Back

The primary key constraint is logically equivalent to the combination of which two other constraints?

Front

UNIQUE and NOT NULL

Back

What does the expression COUNT(salary) mean when used in a SQL SELECT statement?

Front

Count the number of non-NULL values in the salary column

Back

Which type of parameters allow you to pass multiple rows of data into a stored procedure or user-defined function?

Front

Table-valued parameters

Back

What is the name of the default schema created in every database?

Front

dbo

Back

If a trigger aborts due to a run-time error and no exception handler exists, what will occur?

Front

The transaction will be rolled back and control passes to the calling environment.

Back

How many primary keys can a table contain?

Front

0 or 1

Back

If there is an AFTER INSERT trigger on a table, how many times will that trigger fire if you insert 50 rows using a single INSERT?

Front

once

Back

Which database object, when enabled, can execute Transact-SQL code automatically to enforce complex data integrity rules or perform auditing applications on a table?

Front

AFTER trigger

Back

If a stored procedure is running in a production system, and that stored procedure performs a SELECT from a table, what will happen the next time that procedure is run if the table is dropped?

Front

It will fail

Back

What built-in scalar function can examine a list of column names and variables, and return the first non-null value it finds, or return a null if all column names and variables are null?

Front

COALESCE

Back

What constraint is used to override the default value of NULL from being inserted for any column which is not explicitly specified in an INSERT statement?

Front

default

Back

What database object would enforce security on your table by granting different departments permission to different subsets of columns and rows from that table?

Front

a view

Back

Which clause is last in the logical processing order or binding order for a SELECT statement?

Front

TOP

Back

Which clause is typically executed last in a SELECT statement?

Front

the ORDER BY clause

Back

Which operator should be used to determine whether a column contains a value?

Front

The IS NULL operator

Back

What is the term for logical containers in a database that stores database objects such as tables, indexes, and stored procedures?

Front

schemas

Back

If a view is formed by joining two tables together, what database object would allow you to insert a new row into both of the two tables joined together?

Front

an INSTEAD OF trigger

Back

What two DML triggers can be fired by INSERT, UPDATE, or DELETE statements?

Front

AFTER and INSTEAD OF

Back

What business rule creates a one-to-many relationship between rows in two different tables?

Front

foreign key

Back

If a column named State was specified in a table, which constraint would ensure that only the valid two-character abbreviations for state was specified?

Front

CHECK

Back

When one stored procedure calls another, which of the variables and values defined in the calling stored procedure can be seen by the called stored procedure?

Front

Only the variables that were explicitly passed to the called stored procedure in the parameter list

Back

Section 2

(50 cards)

Which clause should you include in an ALTER PARTITION FUNCTION statement to merge two partitions?

Front

MERGE RANGE (boundary_value)

Back

What T-SQL statement allows you to set a local variable to a value of your choosing?

Front

SET

Back

All parameters and local variables in a procedure, function, or trigger must begin with which character?

Front

@

Back

How would you construct an expression using a built-in function to add 30 days to the current date?

Front

DATEADD(day,30,SYSDATETIME())

Back

Which function returns the operating system date and time without any timezone offset?

Front

SYSDATETIME

Back

When specified with the UNION operator, which keyword specifies that every row of the individual SELECT statement result sets, including duplicate rows, should appear in the final result set?

Front

The ALL keyword

Back

What is the correct syntax for a label?

Front

The name of the label terminated by a colon

Back

Can a stored procedure call a function or another stored procedure?

Front

Yes

Back

In order to make the code of your function not readable, what keyword must be part of the header of the CREATE FUNCTION command?

Front

ENCRYPTION

Back

Which statement will improve a query plan by rebuilding statistics on an index, table, or database?

Front

UPDATE STATISTICS

Back

If the mode of a parameter in a procedure or function is not declared, will the default mode be INPUT, OUTPUT, or INPUT/OUTPUT?

Front

INPUT

Back

Which built-in function returns the number of active transactions?

Front

@@TRANCOUNT

Back

Which statement will persist transactional work to the storage and terminate the transaction?

Front

COMMIT TRANSACTION

Back

Which clause in a SELECT statement allows you to establish multiple conditions with a corresponding action for each condition?

Front

the CASE clause

Back

How does a stored procedure use memory to improve performance?

Front

Once a stored procedure is compiled, the compilation remains in memory.

Back

Which SET statement will automatically terminate and roll back a transaction if a run-time error occurs?

Front

SET XACT_ABORT ON

Back

Which T-SQL command used to execute a procedure?

Front

EXEC or EXECUTE

Back

Which T-SQL construct will execute one set of statement (s) when an expression is true or another set of statement(s) when the expression is false?

Front

IF/ELSE

Back

What built-in scalar function can examine a column value, and if it is null, return an alternate value rather than the null?

Front

ISNULL

Back

Which column attribute is not transferred to a new table when using the SELECT INTO statement?

Front

FILESTREAM

Back

How many scalar values can be returned by a function?

Front

one

Back

Which SQL configuration option affects performance of queries that use dynamic values?

Front

the optimize for ad hoc workloads option

Back

What object types is used to return certain columns from a table based on the primary key column of that table using parameters?

Front

A stored procedure or table-valued user defined function

Back

When you create a stored procedure that accepts a table-valued input parameter, which clause must you include for the parameter in the parameter list?

Front

READONLY

Back

When using the current error-handling mechanism in T-SQL, which block contains statements that should execute if an error occurs?

Front

CATCH

Back

Which three SET statements will display details about the execution plan, not a query's result set?

Front

SET SHOWPLAN_ALL, SET SHOWPLAN_TEXT and SET SHOWPLAN_XML

Back

When must columns specified in an ORDER BY clause be included in the SELECT list of the query?

Front

When the DISTINCT keyword, a GROUP BY clause, or the UNION operator is used

Back

Does the use of sequences for primary keys eliminate the possibility of gaps in the assigned values?

Front

No

Back

Which SET statement will begin a transaction automatically when certain T-SQL statements are executed?

Front

SET IMPLICIT_TRANSACTIONS ON

Back

Which is the default for a procedure or function: to execute AS OWNER or to execute AS CALLER?

Front

execute AS CALLER

Back

Which keyword should you include in the CREATE SEQUENCE command to generate repeated numbers in a result set?

Front

CYCLE

Back

Which database object is used to group other database objects to reduce administrative effort?

Front

schema

Back

Which compression type performs Unicode and row compression and also includes prefix and dictionary compression?

Front

page compression

Back

What type of programming objects cannot call a stored procedure?

Front

a function or a view

Back

Which three DML actions can be performed by a MERGE statement?

Front

INSERT, DELETE or UPDATE

Back

In which block is the COMMIT TRANSACTION statement normally inserted in a TRY...CATCH construct?

Front

TRY

Back

What is the result of the following statement: UPDATE emp SET sal += 250?

Front

It will increase the sal column of every row in the emp table by 250 dollars

Back

Which transaction isolation level only uses a schema stability lock, impacts transaction concurrency the least, and allows dirty, non-repeatable, and phantom reads?

Front

READ UNCOMMITTED

Back

Which two permission objects are used to group users in a database to reduce administrative effort?

Front

database or application role

Back

What is a contained database?

Front

A database that is isolated from other databases within its SQL Server instance, so that it can be moved to other SQL Server instances.

Back

Which T-SQL statement should you use if you need to change the source code of your stored procedure without first dropping it?

Front

ALTER PROCEDURE

Back

Which operator should you use to create a single result set consisting of results from two SELECT statements, but excluding duplicates?

Front

The UNION operator

Back

Which physical join operation is optimal for large, non-indexed tables, or when there is a significant difference in size between the two tables?

Front

HASH join

Back

What statement should be used to INSERT rows in a table that are the output of a procedure in table form (not a scalar)?

Front

INSERT EXEC or INSERT EXECUTE

Back

What command changes the code in a user-defined function?

Front

ALTER FUNCTION

Back

What T-SQL statement allows you to establish local variables and assign data types to those variables?

Front

DECLARE

Back

In an INSERT statement, the number of values in the VALUES clause must match the number of what in the INSERT clause?

Front

column names

Back

What T-SQL statement allows you to put a pause in the execution of your program?

Front

WAITFOR

Back

If a function is deterministic, what will occur if you constantly execute that function with the same set of arguments?

Front

It will always return the exact same result.

Back

If a UDF refers to a table which is subsequently dropped, what happens the next time someone tries to run that UDF?

Front

It will fail

Back

Section 3

(50 cards)

Which table hint holds shared, update, or exclusive locks at the page level?

Front

PAGLOCK

Back

In which block is the ROLLBACK TRANSACTION statement normally inserted?

Front

CATCH

Back

Which type of nonclustered index will improve performance for queries that use large tables for aggregation functions and filter and join operations?

Front

columnstore

Back

Which transaction isolation level uses row versioning with update conflict detection?

Front

SNAPSHOT

Back

Which built-in function returns an integer indicating the current state of a transaction?

Front

XACT_STATE

Back

Which two data types can have a specified precision for number of digits stored and a specified scale for the number of digits stored to the right of the decimal point?

Front

numeric and decimal

Back

Which physical join operation is optimal when both tables are not small and relatively similar sizes and are indexed on their join column?

Front

MERGE join

Back

Which physical join operation is optimal when one table has an index and one or both tables are small in size?

Front

LOOP join

Back

Which transaction isolation level is the default for SQL Server 2012?

Front

READ COMMITTED

Back

Which transaction isolation level uses shared locks for read operations and update locks for write operations on each statement, prevents dirty reads, and allows non-repeatable, and phantom reads?

Front

READ COMMITTED

Back

Which data type is used in row iteration when performing row-based operations?

Front

cursor

Back

Which argument in the FOR XML clause will convert FROM sources to XML elements and SELECT columns to XML attributes, and nest inner join sources as children to the original source element?

Front

AUTO

Back

Which query hint will improve a parameterized query based on certain parameter values?

Front

OPTIMIZE FOR

Back

Which compression type stores row values for fixed-length data types as variable-length?

Front

row compression

Back

Which option in an ALTER INDEX statement drops and recreates the index?

Front

REBUILD

Back

What is the maximum number of clustered indexes allowed in a table or view?

Front

one

Back

Which non-standard comparison operator returns true if both operands are not equal?

Front

!=

Back

Which dynamic management view returns only the optimized plans that are cached?

Front

sys.dm_exec_cached_plans

Back

When using the current error-handling mechanism in T-SQL, which block contains statements that may raise an error?

Front

TRY

Back

Which four SET statements will display a result set of statistical information about query execution, not the query's result set?

Front

SET STATISTICS IO, SET STATISTICS XML, SET STATISTICS PROFILE, and SET STATISTICS TIME

Back

Which table hint holds shared, update, or exclusive locks at the table level?

Front

TABLOCK

Back

Which transaction isolation level uses row versioning and update locks for write operations?

Front

READ COMMITTED SNAPSHOT

Back

Which argument specified in the GROUP BY clause is used to specify how columns will be grouped for aggregation?

Front

GROUPING SETS

Back

Which table hint holds shared locks until the transaction completes and is equivalent to SERIALIZABLE?

Front

HOLDLOCK

Back

Which clause is used to define the scope of aggregation functions?

Front

GROUP BY

Back

Which SET statement will ignore the default optimization when processing SELECT statements, and ignores nonclustered indexes?

Front

SET FORCEPLAN ON

Back

Which option in an ALTER INDEX statement will reduce fragmentation on the index without taking the index offline?

Front

REORGANIZE

Back

Which table hint holds exclusive locks until the transaction completes?

Front

XLOCK

Back

Which query hint will force a join in a query to use inner looping?

Front

LOOP

Back

Which table hint holds only exclusive locks at the table level?

Front

TABLOCKX

Back

Which aggregation function returns the number of items in the specified group?

Front

COUNT

Back

Which transaction isolation level uses shared locks for read operations on the entire transaction and update locks for write operations on each statement, prevents dirty and non-repeatable reads, and allows phantom reads?

Front

REPEATABLE READ

Back

Which relational operator takes unique rows from a single column and rotates them into multiple columns with aggregation values for rows?

Front

PIVOT

Back

Which data type is a float with 24-bit storage?

Front

real

Back

Which table hint holds shared, update, or exclusive locks at the row level?

Front

ROWLOCK

Back

Which dynamic management view returns the optimized plans that are cached or currently executing in a text format?

Front

sys.dm_exec_text_query_plan

Back

Which logical operator returns true if a value matches a value within a list?

Front

view

Back

Which option is used in conjunction with the RAISEERROR statement to store an error in the error and application log for the SQL Server instance?

Front

WITH LOG

Back

Which statement marks the start of an explicit transaction?

Front

BEGIN TRANSACTION

Back

When using the current error-handling mechanism in T-SQL, which function returns the error number if invoked in a CATCH block?

Front

ERROR_NUMBER

Back

Which compression type is automated for nchar and nvarchar column using UCS-2 encoding?

Front

Unicode compression

Back

When using the traditional error-handling mechanism in T-SQL, which system function returns a non-zero value, indicating an error occurred?

Front

@@ERROR

Back

Which analytic function will return percent of a value within a partition?

Front

PERCENT_RANK

Back

Which integer value for XACT_STATE indicates there is an active transaction without an error that affects how it is committed or rolled back?

Front

1

Back

Which table hint holds update locks until the transaction completes?

Front

UPDLOCK

Back

Which transaction isolation level uses range locks for index values or all table rows, impacts transaction concurrency the most, and prevents dirty, non-repeatable, and phantom reads?

Front

SERIALIZABLE

Back

Which integer value for XACT_STATE indicates there is no active transaction?

Front

0

Back

What is an indexed view?

Front

A view that has a unique clustered index and is persisted to disk.

Back

Which table hint uses only a schema stability lock and is equivalent to READUNCOMMITTED?

Front

NOLOCK

Back

Which statement will undo transactional work and terminate the transaction?

Front

ROLLBACK TRANSACTION

Back

Section 4

(50 cards)

Which clause should be used in conjunction with the TOP clause to specify which rows are returned?

Front

ORDER BY

Back

Which clause in an XML index optimizes the index for queries that use path expressions?

Front

FOR PATH

Back

Which two logical operators return true if at least one in a set of comparisons is true?

Front

ANY and SOME

Back

Which clause limits a result set to a specified number or percentage of rows?

Front

TOP

Back

Which logical operator returns true if a value is within a range?

Front

BETWEEN

Back

Which logical operator reverses the value of a Boolean operator?

Front

NOT

Back

Which expression is a temporary result set whose scope exists only within the statement where it is defined?

Front

common table expression (CTE)

Back

Which argument in the FOR XML clause will use a <row> element for each row in the result set and convert SELECT columns to XML attributes without nesting?

Front

RAW

Back

Which analytic function compares previous row(s) in the same result set without a self-join?

Front

LAG

Back

Which set operator returns any distinct values found in both the first query and second query?

Front

INTERSECT

Back

Which database object is a grouping of SQL statements that can receive and send arguments and return a value and/or result set?

Front

stored procedure

Back

Which four numeric data type store variable-sized integer values?

Front

bigint, int, smallint, and tinyint

Back

Which APPLY operator returns only those rows that match between the outer query and the table-valued function?

Front

CROSS APPLY

Back

Which function generates a random 16-byte GUID?

Front

NEWID

Back

Which data types stored variable sized data, intended for images, Office documents and other raw content?

Front

varbinary

Back

Which set operator combines all rows from multiple queries into a single result set with no duplicated rows?

Front

UNION

Back

Which spatial aggregate method will combine multiple spatial objects into logical geometric shapes with interior boundaries remaining?

Front

CollectionAggregate

Back

Which function replaces NULL values with a specified value?

Front

ISNULL

Back

Which dynamic management function returns the metadata for the first result set of a stored procedure or trigger?

Front

sys.dm_exec_describe_first_result_for_object

Back

Which analytic function will return the median value within a partition?

Front

PERCENTILE_DISC

Back

Which relational operator invokes a table-valued function for each row returned by a query?

Front

APPLY

Back

Which ISO standard comparison operator returns true if both operands are not equal?

Front

<>

Back

Which data type represents a binary 1 or 0?

Front

bit

Back

Which default join type includes all matching rows in both tables?

Front

inner join

Back

Which two data conversion functions accept any value type and attempt to return that value as the specified data type?

Front

CAST and CONVERT

Back

Which two data types represent a variable number of characters?

Front

varchar and nvarchar

Back

Which join type includes all rows in the first table and matching rows in the second table?

Front

left outer join

Back

Which two data types represent a fixed number of characters?

Front

char and nchar

Back

Which data type stores hierarchical values to support fine-grained access, indexing, and validation?

Front

xml

Back

Which logical operator returns true if any rows are returned by a subquery?

Front

EXISTS

Back

Which relational operator takes unique columns from a single row and rotates them into multiple rows?

Front

UNPIVOT

Back

Which clause is used in conjunction with the RANK function to specify aggregation functions and partitioning?

Front

OVER

Back

Which three data conversion functions will return a value if successful, but will return NULL if unsuccessful?

Front

TRY_CAST, TRY_CONVERT, and TRY_PARSE

Back

Which data type is a datetime that also supports localization across time zones?

Front

datetimeoffset

Back

Which type of user-defined function (UDF) should you use to perform a complex calculation for a computed column or dynamic table lookups in a WHERE clause?

Front

scalar-valued UDF

Back

Which analytic function compares next row(s) in the same result set without a self-join?

Front

LEAD

Back

Which data type has a larger date range than a datetime and supports user-specified precision?

Front

datetime2

Back

Which join type includes matching rows in the first table and all rows in the second table?

Front

right outer join

Back

Which function distributes values based on its relative placement in a logical grouping based on its partition and skips ranking for ties?

Front

RANK

Back

Which data type can have a specified storage size for its mantissa?

Front

float

Back

Which option in the FOR XML clause will convert SELECT columns to XML elements?

Front

ELEMENTS

Back

Which data conversion function accepts a string value and attempts to return that value as the specified data type for an optional culture?

Front

PARSE

Back

Which spatial aggregate method will remove interior boundaries between spatial objects and combine contiguous spatial objects into a composite spatial object?

Front

UnionAggregate

Back

Which clause is used in conjunction with the GROUP BY clause to limit the aggregated rows in a result set?

Front

HAVING

Back

Which join type will combine each row from the first table with each row of the second table?

Front

cross join

Back

Which logical operator returns true if all comparisons are true?

Front

ALL

Back

Which clause is used to specify a common table expression (CTE)?

Front

WITH clause

Back

Which logical operator returns true if a value matches a wildcard pattern?

Front

LIKE

Back

Which APPLY operator includes those rows in the outer query that do not have matching rows in the table-valued function?

Front

OUTER APPLY

Back

Which argument specified in the GROUP BY clause aggregates subtotals and calculates a grand total depending on the order of specified columns?

Front

ROLLUP

Back

Section 5

(14 cards)

Which logical operator returns true if only one of two Boolean expressions is true?

Front

OR

Back

Which function will return the first non-null value in a set of expressions?

Front

COALESCE

Back

Which database object is a routine that must be called within a T-SQL statement to execute?

Front

user-defined function (UDF)

Back

Which function generates an incremented 16-byte GUID and offers better performance over NEWID?

Front

NEWSEQUENTIALID

Back

Which type of user-defined function (UDF) should you use to return multiple values, such as data from multiple events or table usage statistics?

Front

table-valued UDF

Back

Which spatial aggregate method will combine multiple spatial objects into logical geometric shapes and distort the overall shape by surrounding the object in an ellipse?

Front

EnvelopeAggregate

Back

Which two data types specify monetary amounts with accuracy to a ten-thousandth?

Front

money and smallmoney

Back

Which data types support conversion to xml?

Front

nvarchar and varbinary

Back

Which set operator returns any distinct values in the first query not found in the second query?

Front

EXCEPT

Back

Which spatial aggregate method will combine multiple spatial objects into logical geometric shapes and distort the overall shape by surrounding the object in a standard polygon?

Front

ConvexHullAggregate

Back

Which analytic function will return the calculated median within a partition?

Front

PERCENTILE_CONT

Back

Which function distributes values based on its relative placement in a logical grouping based on its partition and continues ranking for ties?

Front

DENSE_RANK

Back

Which dynamic management function returns the metadata for the first result set of a T-SQL statement?

Front

sys.dm_exec_describe_first_result

Back

Which logical operator returns true if two Boolean expressions are true?

Front

AND

Back