SQL Reference Home
Welcome to the Microsoft SQL Server Transact-SQL (T-SQL) reference documentation. This section provides comprehensive information on the syntax, functions, statements, and data types used in SQL Server.
T-SQL Syntax
Understand the fundamental structure and rules for writing valid T-SQL queries and statements.
T-SQL Functions
Explore the wide range of built-in functions available to manipulate data, perform calculations, and manage your database.
- Aggregate Functions (e.g.,
COUNT
,SUM
,AVG
) - Scalar Functions (e.g.,
GETDATE()
,LEN()
,UPPER()
) - Table-Valued Functions
T-SQL Statements
Master the various statements used for creating, manipulating, and controlling access to your data.
- Data Definition Language (DDL):
CREATE
,ALTER
,DROP
- Data Manipulation Language (DML):
SELECT
,INSERT
,UPDATE
,DELETE
- Data Control Language (DCL):
GRANT
,REVOKE
T-SQL Data Types
Understand the different types of data you can store in SQL Server and their properties.
Stored Procedures
Learn how to create and use stored procedures to encapsulate logic and improve performance.
Views
Discover how views can be used to simplify complex queries and enhance security.
Getting Started with T-SQL
T-SQL is the procedural extension of SQL that provides the following capabilities:
- Control-of-flow language statements.
- Local variables.
- Specialized procedural programming constructs.
- Error handling.
Here's a simple example of a SELECT
statement:
SELECT CustomerID, CompanyName
FROM Customers
WHERE Country = 'USA';
Commonly Used Resources
Date and Time Functions
Functions for working with date and time values.
String Functions
Functions for manipulating string data.
Mathematical Functions
Functions for performing mathematical operations.