Interview Practice Questions

Q1: What is the T-SQL command to create a user-defined aggregate function?
CREATE AGGREGATE
Q2: What is the T-SQL command to drop a user-defined aggregate function
DROP AGGREGATE
Q3: What is the T-SQL command to add an application role to the current database?
CREATE APPLICATION ROLE
Q4: What is the T-SQL command to change the name, password, or default schema of an application role
ALTER APPLICATION ROLE
Q5: What is the T-SQL command to remove an application role from the current database?
DROP APPLICATION ROLE
Q6: What is the T-SQL command to upload an assembly that was previously compiled as a ?dll file
CREATE ASSEMBLY
Q7: What is the T-SQL command to alter the T-SQL server catalog properties of an assembly?
ALTER ASSEMBLY
Q8: What is the T-SQL command to remove an assembly and all its associated files from the current database?
DROP ASSEMBLY
Q9: What is the T-SQL command to change the ownership of an entity?
ALTER AUTHORIZATION
Q10: What is the T-SQL command to backup a database, transaction log, files, or file groups?
BACKUP
Q11: What is the T-SQL command to export a certificate to a file?
BACKUP CERTIFICATE
Q12: What is the T-SQL command to bulk copy
BCP
Q13: What is the T-SQL command to
BEGIN [DIALOG [CONVERSATION]] —
Q14: What is the T-SQL command to alter a certificate in the database?
ALTER CERTIFICATE
Q15: What is the T-SQL command to add a certificate to the database?
CREATE CERTIFICATE
Q16: What is the T-SQL command to remove a certificate from the database?
DROP CERTIFICATE
Q17: What is the T-SQL command to write all dirty pages to disk?
CHECKPOINT
Q18: What is the T-SQL command to check consistency of disk allocation?
DBCC CHECKALLOC
Q19: What is the T-SQL command to check catalog consistency?
DBCC CHECKCATALOG
Q20: What is the T-SQL command to check integrity of table constraints?
DBCC CHECKCONSTRAINTS
Q21: What is the T-SQL command to check allocation and integrity of all objects
DBCC CHECKDB
Q22: What is the T-SQL command to check all tables and indexed views in a filegroup?
DBCC CHECKFILEGROUP
Q23: What is the T-SQL command to check identity value for a table?
DBCC CHECKIDENT
Q24: What is the T-SQL command to check integrity of a table or indexed view?
DBCC CHECKTABLE
Q25: What is the T-SQL command to reclaim space from dropped variable-length columns?
DBCC CLEANTABLE
Q26: What is the T-SQL command to mark the end of a transaction?
COMMIT
Q27: What is the T-SQL command to create a contract in the database?
CREATE CONTRACT
Q28: What is the T-SQL command to drop a contract from the database?
DROP CONTRACT
Q29: What is the T-SQL command to change properties of a credential?
CREATE CREDENTIAL
Q30: What is the T-SQL command to change properties of a credential?
ALTER CREDENTIAL
Q31: What is the T-SQL command to remove a credential from the server?
DROP CREDENTIAL
Q32: What is the T-SQL command to create a new database & storage files?
CREATE DATABASE
Q33: What is the T-SQL command to modify a database or the database files and file groups
ALTER DATABASE
Q34: What is the T-SQL command to remove a database from the server?
DROP DATABASE
Q35: What is the T-SQL command to help for dbcc commands?
DBCC HELP
Q36: This is a website to view T-SQL DBCC deprecated commands.
Q37: This is a website to view T-SQL DBCC undocumented commands.
Q38: What is the T-SQL command to unload a dll from memory?
DBCC dllname
Q39: What is the T-SQL command to
DECLARE —
Q40: What is the T-SQL command to remove rows from a table?
DELETE
Q41: What is the T-SQL command to deny object permissions?
DENY Object permissions.
Q42: What is the T-SQL command to deny user permissions?
DENY User/Role
Q43: What is the T-SQL command to remove all clean buffers from the buffer pool?
DBCC DROPCLEANBUFFERS
Q44: What is the T-SQL command to create an event notification trigger?
CREATE EVENT NOTIFICATION
Q45: What is the T-SQL command to remove an event notification trigger from the current database?
DROP EVENT NOTIFICATION
Q46: What is the T-SQL command to execute a stored procedure or function?
EXECUTE
Q47: What is the T-SQL command to set the execution context of a session?
EXECUTE AS
Q48: What is the T-SQL command to test for the existence of rows?
EXISTS
Q49: What is the T-SQL command to remove items from plan cache?
DBCC FREEPROCCACHE
Q50: What is the T-SQL command to flush the distributed query connection cache?
DBCC FREESESSIONCACHE
Q51: What is the T-SQL command to release all unused cache entries from all caches?
DBCC FREESYSTEMCACHE
Q52: What is the T-SQL command to create a full-text catalog for the database?
CREATE FULLTEXT CATALOG
Q53: What is the T-SQL command to create a full-text catalog for the database?
ALTER FULLTEXT CATALOG
Q54: What is the T-SQL command to remove a full-text catalog from a database?
DROP FULLTEXT CATALOG
Q55: What is the T-SQL command to create a full-text index on a table?
CREATE FULLTEXT INDEX
Q56: What is the T-SQL command to change properties of a full-text index?
ALTER FULLTEXT INDEX
Q57: What is the T-SQL command to remove a full-text index from a table?
DROP FULLTEXT INDEX
Q58: What is the T-SQL command to create a user-defined function?
CREATE FUNCTION
Q59: What is the T-SQL command to alter a user-defined function?
ALTER FUNCTION
Q60: What is the T-SQL command to remove a user-defined function?
DROP FUNCTION
Q61: What is the T-SQL command to send the current batch of T-T-SQL statements to an instance of T-SQL server?
GO
Q62: What is the T-SQL command to grant permissions to system objects, database objects, or application role
GRANT Object
Q63: What is the T-SQL command to grant permissions to a database user or database role
GRANT User/Role
Q64: What is the T-SQL command to conditionally execute T-T-SQL statements?
IF
Q65: What is the T-SQL command to create an index on a table or view?
CREATE INDEX
Q66: What is the T-SQL command to modify an existing index on a table or view?
ALTER INDEX
Q67: What is the T-SQL command to remove one or more relational or xml indexes from the current database?
DROP INDEX
Q68: What is the T-SQL command to display last statement sent from a client to a database instance?
DBCC INPUTBUFFER
Q69: What is the T-SQL command to add a new row to a table or view?
INSERT
Q70: What is the T-SQL command to run an T-SQL script (PowerShell/T-SQLcmd)?
Invoke-SQLcmd
Q71: What is the T-SQL command to
iSQL -U user -P password -i script.SQL -o logfile.log
Q72: What is the T-SQL command to create a key in the database?
CREATE KEY ASYMMETRIC / SYMMETRIC
Q73: What is the T-SQL command to change the properties of a key?
ALTER KEY ASYMMETRIC / SYMMETRIC
Q74: What is the T-SQL command to drop a key from the database?
DROP KEY ASYMMETRIC / SYMMETRIC
Q75: What is the T-SQL command to decrypt a symmetric key and makes it available for use?
OPEN KEY SYMMETRIC
Q76: What is the T-SQL command to close one or all symmetric keys open in the current session?
CLOSE KEY SYMMETRIC
Q77: What is the T-SQL command to terminate a user process?
KILL
Q78: What is the T-SQL command to remove a query notification subscription from the instance?
KILL QUERY NOTIFICATION
Q79: What is the T-SQL command to terminate an asynchronous statistics update job?
KILL STATS JOB
Q80: What is the T-SQL command to create a T-SQL server login account (user)?
CREATE LOGIN
Q81: What is the T-SQL command to change properties of a T-SQL server login account?
ALTER LOGIN
Q82: What is the T-SQL command to remove a T-SQL server login account?
DROP LOGIN
Q83: What is the T-SQL command to create a database master key?
CREATE MASTER KEY
Q84: What is the T-SQL command to alter properties of a database master key?
ALTER MASTER KEY / ALTER SERVICE MASTER KEY
Q85: What is the T-SQL command to export the database master key?
BACKUP MASTER KEY / BACKUP SERVICE MASTER KEY
Q86: What is the T-SQL command to remove the master key from the current database?
DROP MASTER KEY
Q87: What is the T-SQL command to import a database master key from a backup file?
RESTORE MASTER KEY / RESTORE SERVICE MASTER KEY
Q88: What is the T-SQL command to create a new message type?
CREATE MESSAGE TYPE
Q89: What is the T-SQL command to change properties of a message type?
ALTER MESSAGE TYPE
Q90: What is the T-SQL command to drop an existing message type?
DROP MESSAGE TYPE
Q91: What is the T-SQL command to display information about recent transactions?
DBCC OPENTRAN
Q92: What is the T-SQL command to display last statement sent from a client to a database instance?
DBCC OUTPUTBUFFER
Q93: What is the T-SQL command to create a partition function in the current database?
CREATE PARTITION FUNCTION
Q94: What is the T-SQL command to alter the boundary values for a partition function?
ALTER PARTITION FUNCTION
Q95: What is the T-SQL command to drop a partition function from the current database?
DROP PARTITION FUNCTION
Q96: What is the T-SQL command to create a partition scheme in the current database?
CREATE PARTITION SCHEME
Q97: What is the T-SQL command to change the allocation of a next used filegroup to a partition scheme?
ALTER PARTITION SCHEME
Q98: What is the T-SQL command to drop a partition function from the current database?
DROP PARTITION SCHEME
Q99: What is the T-SQL command to create a stored procedure?
CREATE PROCEDURE
Q100: What is the T-SQL command to modify a previously created stored procedure?
ALTER PROCEDURE
Q101: What is the T-SQL command to drop one or more stored procedures from the current database?
DROP PROCEDURE
Q102: What is the T-SQL command to display information about the procedure cache?
DBCC PROCCACHE
Q103: What is the T-SQL command to create a message queue?
CREATE QUEUE
Q104: What is the T-SQL command to change the properties of a message queue?
ALTER QUEUE
Q105: What is the T-SQL command to drop a queue?
DROP QUEUE
Q106: What is the T-SQL command to define remote service security credentials?
CREATE REMOTE SERVICE BINDING
Q107: What is the T-SQL command to modify remote service security credentials?
ALTER REMOTE SERVICE BINDING
Q108: What is the T-SQL command to drop a remote service binding?
DROP REMOTE SERVICE BINDING
Q109: What is the T-SQL command to restore a database from a full backup?
RESTORE DATABASE Complete
Q110: What is the T-SQL command to restore parts of a database/point in time?
RESTORE DATABASE Partial
Q111: What is the T-SQL command to restore files, filegroups, or pages
RESTORE DATABASE Files
Q112: What is the T-SQL command to restore a transaction log?
RESTORE LOGS
Q113: What is the T-SQL command to revert to a database snapshot?
RESTORE DATABASE_SNAPSHOT
Q114: What is the T-SQL command to list data/log files?
RESTORE FILELISTONLY
Q115: What is the T-SQL command to list backup header info?
RESTORE HEADERONLY
Q116: What is the T-SQL command to media info?
RESTORE LABELONLY
Q117: What is the T-SQL command to rewind and close tape device?
RESTORE REWINDONLY
Q118: What is the T-SQL command to
RESTORE VERIFYONLY —
Q119: What is the T-SQL command to switch execution context back to the caller of the last execute as statement?
REVERT
Q120: What is the T-SQL command to revoke permissions on system objects and database objects
REVOKE Object
Q121: What is the T-SQL command to revoke permissions granted or denied to a database user or role/app role?
REVOKE User/Role
Q122: What is the T-SQL command to create a new database role in the current database?
CREATE ROLE
Q123: What is the T-SQL command to change the name of a database role?
ALTER ROLE
Q124: What is the T-SQL command to delete a role from the database?
DROP ROLE
Q125: What is the T-SQL command to undo a transaction completely or to a savepoint
ROLLBACK
Q126: What is the T-SQL command to add a new route to the routing table for the current database?
CREATE ROUTE
Q127: What is the T-SQL command to modify properties of a route?
ALTER ROUTE
Q128: What is the T-SQL command to delete a route from the current database?
DROP ROUTE
Q129: What is the T-SQL command to create a schema in the current database?
CREATE SCHEMA
Q130: What is the T-SQL command to transfer a securable between schemas?
ALTER SCHEMA
Q131: What is the T-SQL command to remove a schema from the database?
DROP SCHEMA
Q132: What is the T-SQL command to retrieve rows from the database?
SELECT
Q133: What is the T-SQL command to send a message using an existing conversation
SEND
Q134: What is the T-SQL command to display information about the server instance?
SERVERPROPERTY
Q135: What is the T-SQL command to create a new service (a task or set of tasks)?
CREATE SERVICE
Q136: What is the T-SQL command to create a new service (a task or set of tasks)?
ALTER SERVICE
Q137: What is the T-SQL command to remove a service from the database?
DROP SERVICE
Q138: What is the T-SQL command to return the user name of the current context in the current database?
SESSION_USER
Q139: What is the T-SQL command to display the set options currently set for a session?
SESSIONPROPERTY
Q140: What is the T-SQL command to set a local variable?
SET @local_variable
Q141: What is the T-SQL command to
SET —
Q142: What is the T-SQL command to display the current distribution statistics?
DBCC SHOW_STATISTICS
Q143: What is the T-SQL command to shrink the size of the database data and log files?
DBCC SHRINKDATABASE
Q144: What is the T-SQL command to shrink or empty a database data or log file?
DBCC SHRINKFILE
Q145: What is the T-SQL command to immediately stop T-SQL server?
SHUTDOWN
Q146: What is the T-SQL command to add a digital signature to a stored procedure or function?
ADD SIGNATURE
Q147: What is the T-SQL command to delete a digital signature from a stored procedure or function?
DROP SIGNATURE
Q148: What is the T-SQL command to run a T-T-SQL statement, procedure or script
SQLCMD
Q149: What is the T-SQL command to display transaction-log space statistics? reset wait and latch statistics?
DBCC SQLPERF
Q150: What is the T-SQL command to create statistics for one or more table columns in the current database?
CREATE STATISTICS
Q151: What is the T-SQL command to update statistics for one or more table columns in the current database?
UPDATE STATISTICS
Q152: What is the T-SQL command to drop statistics in the current database?
DROP STATISTICS
Q153: What is the T-SQL command to create a synonym?
CREATE SYNONYM
Q154: What is the T-SQL command to remove a synonym?
DROP SYNONYM
Q155: What is the T-SQL command to create a new table?
CREATE TABLE
Q156: What is the T-SQL command to modify a table definition?
ALTER TABLE
Q157: What is the T-SQL command to remove one or more tables?
DROP TABLE
Q158: What is the T-SQL command to remove all rows from a table?
TRUNCATE TABLE
Q159: What is the T-SQL command to start a T-T-SQL distributed transaction?
BEGIN DISTRIBUTED TRANSACTION
Q160: What is the T-SQL command to enable or disable trace flags?
DBCC TRACE...
Q161: What is the T-SQL command to mark the starting point of an explicit
BEGIN TRANSACTION
Q162: What is the T-SQL command to mark the end of a successful implicit or explicit transaction?
COMMIT TRANSACTION
Q163: What is the T-SQL command to create a dml or ddl trigger?
CREATE TRIGGER
Q164: What is the T-SQL command to modify the definition of a dml or ddl trigger?
ALTER TRIGGER
Q165: What is the T-SQL command to enable a trigger?
ENABLE TRIGGER
Q166: What is the T-SQL command to disable a trigger?
DISABLE TRIGGER
Q167: What is the T-SQL command to remove one or more triggers from the current database?
DROP TRIGGER
Q168: What is the T-SQL command to create an alias data type or user-defined type (clr) in the current database?
CREATE TYPE
Q169: What is the T-SQL command to remove an alias data type or user-defined type (clr) from the current database?
DROP TYPE
Q170: What is the T-SQL command to combine the results of two or more queries into a single result set?
UNION
Q171: What is the T-SQL command to change existing data in a table?
UPDATE
Q172: What is the T-SQL command to report and correct page and row count inaccuracies in catalog views?
DBCC UPDATEUSAGE
Q173: What is the T-SQL command to return the set options currently active?
DBCC USEROPTIONS
Q174: What is the T-SQL command to add a user to the current database?
CREATE USER
Q175: What is the T-SQL command to rename a database user or change its default schema?
ALTER USER
Q176: What is the T-SQL command to remove a user from the current database?
DROP USER
Q177: What is the T-SQL command to switch the database context to the specified database or database snapshot?
USE
Q178: What is the T-SQL command to create a view: a virtual table that represents the data in one or more tables?
CREATE VIEW
Q179: What is the T-SQL command to modify an existing view?
ALTER VIEW
Q180: What is the T-SQL command to remove one or more views from the current database?
DROP VIEW
Q181: What is the T-SQL command to import schema components into a database?
CREATE XML SCHEMA COLLECTION
Q182: What is the T-SQL command to add new schema components to an existing xml schema collection?
ALTER XML SCHEMA COLLECTION
Q183: What is the T-SQL command to delete an entire xml schema collection and all of its components?
DROP XML SCHEMA COLLECTION