T-SQL Glossary
A comprehensive list of terms and definitions used in Transact-SQL (T-SQL), Microsoft's procedural extension to SQL.
ALTER DATABASE
A T-SQL statement used to modify the properties of an existing database, such as changing its size, enabling or disabling features, or altering its recovery model.
AVG()
An aggregate function that calculates the average value of a numeric expression in a set of rows.
BACKUP DATABASE
A T-SQL statement used to create a copy of a database to protect against data loss and enable recovery.
CASE Expression
A T-SQL expression that allows you to return different values based on specified conditions. It functions similarly to an IF-THEN-ELSE statement.
CLUSTER INDEX
A type of index where the leaf nodes of the index contain the actual data rows of the table. A table can have only one clustered index.
COMMIT TRANSACTION
A T-SQL statement that saves all changes made within the current transaction to the database. It marks the successful end of a transaction.
CREATE DATABASE
A T-SQL statement used to create a new database in SQL Server.
CURSOR
A database object that enables traversal through the records in a database, typically within a result set from a query. Cursors allow row-by-row processing.
DELETE
A T-SQL statement used to remove one or more rows from a table based on specified criteria.
DROP DATABASE
A T-SQL statement used to permanently remove a database and all its associated objects from SQL Server.
EXECUTE (EXEC)
A T-SQL command used to execute a stored procedure or a batch of T-SQL statements.
FOREIGN KEY
A column or a set of columns in one table that refers to the PRIMARY KEY in another table. It enforces referential integrity between tables.
GROUP BY
A T-SQL clause used to group rows that have the same values in one or more columns into a summary row. Often used with aggregate functions.
HAVING
A T-SQL clause used to filter groups created by the GROUP BY clause. It's similar to WHERE, but operates on grouped results.
IF...ELSE Statement
A control-flow statement in T-SQL that executes a block of statements if a specified condition is true, and optionally executes another block if the condition is false.
INDEX
A database structure that improves the speed of data retrieval operations on a table by providing quick lookup of rows based on specific column values.
INSERT
A T-SQL statement used to add one or more new rows of data into a table.
JOIN
A T-SQL clause used to combine rows from two or more tables based on a related column between them. Common types include INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL OUTER JOIN.
MAX()
An aggregate function that returns the maximum value from a set of values.
MIN()
An aggregate function that returns the minimum value from a set of values.
NONCLUSTERED INDEX
A type of index that has a logical order similar to a clustered index but does not store the actual data rows. The leaf nodes contain pointers to the data rows.
ORDER BY
A T-SQL clause used to sort the result set of a query in ascending (ASC) or descending (DESC) order based on one or more columns.
PRIMARY KEY
A column or a set of columns that uniquely identifies each row in a table. It enforces entity integrity and cannot contain NULL values.
ROLLBACK TRANSACTION
A T-SQL statement used to undo all changes made within the current transaction. It restores the database to the state it was in before the transaction began.
SELECT
The fundamental T-SQL statement used to retrieve data from one or more tables in a database.
STORED PROCEDURE
A precompiled collection of T-SQL statements that can be executed as a single unit. Stored procedures improve performance, security, and code reusability.
SUM()
An aggregate function that calculates the sum of all values in a numeric column or expression.
TRANSACTION
A sequence of one or more T-SQL operations that are treated as a single, indivisible unit of work. Transactions ensure data consistency and integrity using ACID properties (Atomicity, Consistency, Isolation, Durability).
TRIGGER
A special type of stored procedure that automatically executes in response to certain events on a table or view, such as INSERT, UPDATE, or DELETE operations.
UNIQUE CONSTRAINT
A rule that enforces that all values in a column or a set of columns must be distinct. It ensures that no duplicate values exist, except for NULL values.
UPDATE
A T-SQL statement used to modify existing data in one or more rows of a table.
VIEW
A virtual table based on the result set of a stored SQL query. A view contains rows and columns, just like a real table, but it does not store data itself.
WHERE Clause
A T-SQL clause used to filter records from a query. It specifies conditions that rows must meet to be included in the result set.