Triggers
T-SQL Statements
Operators
Data Conversion&String Conversion
MetaData
100

What is a trigger in T-SQL?

 - A trigger is a special type of stored procedure that is automatically executed in response to certain events, such as an insert, update, or delete operation on a table.

100

What is the IF statement used for in T-SQL?

The IF statement is used to execute a block of code if a certain condition is true.

100

What is the difference between the AND and OR operators in T-SQL?

The AND operator returns true if both conditions are true, while the OR operator returns true if either condition is true.

100

What is data conversion in T-SQL?

What is CAST and in T-SQL?


 Data conversion is the process of converting one data type to another data type.

CAST is a function that converts an expression of one data type to another data type.

CONVERT is a function that converts an expression of one data type to another data type.

100

 What is metadata in SQL Server?


Metadata refers to information about database objects such as tables, columns, indexes, and constraints.

200

What are the types of triggers in T-SQL?

 - There are two types of triggers in T-SQL: After Triggers and Instead of Triggers.

200

What is the WHILE statement used for in T-SQL?

 The WHILE statement is used to execute a block of code repeatedly as long as a certain condition is true.

200

How do you use the NOT operator in T-SQL?

You can use the NOT operator in T-SQL to negate a condition.

200

What is CONCAT  and  SUBSTRING in T-SQL?

CONCAT is a function that concatenates two or more strings into a single string.

SUBSTRING is a function that returns part of a string based on its starting position and length.

200

How do you view metadata for columns in SQL Server?

You can view metadata for columns in SQL Server by querying system views such as sys.columns or INFORMATION_SCHEMA.COLUMNS.

300

What are the special tables used by triggers in T-SQL?

Triggers use two special tables called inserted and deleted. The inserted table contains the new data that was inserted into the table, while the deleted table contains the old data that was deleted from the table.

300

What is @@ROWCOUNT in T-SQL?

What is the difference between @@ROWCOUNT and @@IDENTITY in T-SQL?

@@ROWCOUNT is a system function that returns the number of rows affected by the last statement executed.

while @@IDENTITY returns the last identity value generated for any table in the current session.

300

What is the difference between the LIKE and IN operators in T-SQL?

The LIKE operator is used to compare a string to a pattern, while the IN operator is used to compare a value to a list of values.

300

How do you concatenate multiple columns into a single string in T-SQL?

You can concatenate multiple columns into a single string in T-SQL by using the CONCAT function or by using the + operator.

300

How do you view metadata for indexes in SQL Server?

You can view metadata for indexes in SQL Server by querying system views such as sys.indexes or sys.index_columns.

400

How do you create a trigger in T-SQL?

You can create a trigger using the CREATE TRIGGER statement.

400

 What is ISNULL in T-SQL?

ISNULL is a function that returns a specified value if an expression is NULL, otherwise it returns the expression itself.

400

What are logical operators in T-SQL?

Logical operators are used to combine two or more conditions into a single condition. The logical operators in T-SQL are AND, OR, and NOT.

400

What is the difference between CHARINDEX and PATINDEX in T-SQL?

CHARINDEX and PATINDEX are both used to search for a pattern within a string in T-SQL. CHARINDEX searches for an exact match, while PATINDEX searches for a pattern match using wildcards.

400

How do you view metadata for stored procedures in SQL Server?

You can view metadata for stored procedures in SQL Server by querying system views such as sys.procedures or INFORMATION_SCHEMA.ROUTINES.

500

How do you disable a trigger in T-SQL?

You can disable a trigger in T-SQL by using the ALTER TABLE statement with the DISABLE TRIGGER option.

500

What is the difference between the IF and CASE statements in T-SQL?

The IF statement is used to execute a block of code if a certain condition is true, while the CASE statement is used to evaluate a list of conditions and return a value based on the first condition that is true.

500
  1. How does the IS operator differ from the = operator in T-SQL? and What are the possible values returned by the IS operator in T-SQL?
  • The = operator is used to compare two values for equality, while the IS operator is used to compare a value to NULL.


  • The possible values returned by the IS operator in T-SQL are TRUE, FALSE, and UNKNOWN.
500

How do you remove leading or trailing spaces from a string in T-SQL?

You can remove leading or trailing spaces from a string in T-SQL by using the LTRIM and RTRIM functions.

500

How do you view metadata for tables in SQL Server?

 You can view metadata for tables using system views such as sys.tables and sys.columns.

M
e
n
u