SQL Server (T-SQL) Keywords by Category

Introduction

If you have spent any time learning SQL Server or working as a database administrator, you have probably heard the same warning repeated again and again: never use reserved words or keywords when naming database objects. This advice exists for a good reason. Keywords are special terms that SQL Server and the ANSI SQL standard reserve for specific commands, clauses, and operations. Using them incorrectly can lead to syntax errors, confusing code, and long-term maintenance headaches.

When I first started learning SQL Server, I accepted this advice but still had a lingering question — what exactly are all the SQL Server keywords? As I advanced in my DBA journey, that question became even more important. Without knowing the full list of keywords, it’s easy to accidentally name a table, column, or variable something that conflicts with SQL syntax. Understanding keywords is not just about avoiding mistakes; it’s about writing clean, professional, future-proof T-SQL code.

Another best practice I frequently encountered was to prefer ANSI-standard SQL syntax whenever possible instead of SQL Server–specific alternatives. ANSI standards exist to ensure SQL code behaves consistently across different database systems. But that raised another important question: how do you know which commands are ANSI-standard and which ones are unique to SQL Server?

A simple example highlights why this matters. When writing a comparison for “not equal,” SQL Server allows both != and <>. However, <> is the ANSI-standard operator, while != is a SQL Server–specific alternative. Choosing the ANSI-standard operator improves portability, aligns with industry standards, and reinforces good coding habits.

In this article, SQL Server (T-SQL) Keywords by Category, we will explore the complete list of SQL Server keywords organized into logical groups such as DDL, DML, DCL, and control-of-flow statements. We will also identify which keywords are part of the ANSI SQL standard and which ones are proprietary to SQL Server. By the end of this guide, you will have a clear reference for every major T-SQL keyword and a deeper understanding of how to write standardized, professional, and maintainable SQL code.

Be aware that even SQL Server has additional reserved words (for example, for special features or legacy compatibility) that are rarely used in day‑to‑day T‑SQL.

Important Notes

  • An asterisk * after the keyword indicates the keyword exists in the ANSI SQL standard.
  • Non-starred items are SQL Server–specific T-SQL extensions.
  • Microsoft occasionally adds new keywords in newer SQL Server versions — this list is current as of SQL Server 2022.
  • Some keywords function as both reserved words and built-in functions depending on context.

Prerequisites

There are no Prerequisites for this article, save for the ability to read and comprehend.

Data Definition Language (DDL)

Used to create and modify database objects.

  • ADD *
  • ALTER *
  • AS *
  • AUTHORIZATION *
  • BACKUP
  • BEGIN
  • BREAK
  • BROWSE
  • CHECK *
  • CHECKPOINT
  • CLOSE
  • CLUSTERED
  • COALESCE *
  • COLLATE
  • COLUMN *
  • COMMIT *
  • CONSTRAINT *
  • CREATE *
  • CROSS *
  • CURRENT_TIMESTAMP *
  • CURRENT_USER *
  • DATABASE
  • DBCC
  • DEALLOCATE *
  • DECLARE
  • DEFAULT *
  • DELETE *
  • DENY
  • DISABLE
  • DISTINCT *
  • DROP *
  • DUMP
  • ENABLE
  • END
  • EXECUTE *
  • EXIT
  • EXTERNAL
  • FETCH *
  • FILE
  • FILLFACTOR
  • FOREIGN *
  • FUNCTION
  • GRANT *
  • GROUP *
  • HAVING *
  • IDENTITY
  • INDEX
  • INNER *
  • INSERT *
  • INSTEAD
  • JOIN *
  • KEY *
  • KILL
  • LEFT *
  • LIKE *
  • MERGE *
  • NATIONAL *
  • NOCHECK
  • NONCLUSTERED
  • NOT *
  • NULL *
  • OBJECT
  • OF *
  • OFF
  • ON *
  • OPEN
  • OPTION
  • OR *
  • ORDER *
  • OUTER *
  • OVER
  • PRIMARY *
  • PROCEDURE
  • PUBLIC
  • REFERENCES *
  • REPLICATION
  • RESTORE
  • RESTRICT *
  • RETURN
  • REVERT
  • REVOKE *
  • RIGHT *
  • ROLLBACK *
  • RULE
  • SCHEMA *
  • SELECT *
  • SET *
  • TABLE *
  • TRANSACTION *
  • TRIGGER
  • TRUNCATE *
  • UNION *
  • UNIQUE *
  • UPDATE *
  • USE
  • VIEW
  • WHERE *
  • WITH *

Data Manipulation Language (DML)

Used to read and modify data.

  • DELETE *
  • INSERT *
  • MERGE *
  • SELECT *
  • UPDATE *
  • OUTPUT
  • READTEXT
  • WRITETEXT
  • UPDATETEXT

Data Control Language (DCL)

Used to control permissions and security.

  • DENY
  • GRANT *
  • REVOKE *

Transaction Control Language (TCL)

Used for transaction handling.

  • BEGIN TRANSACTION
  • COMMIT *
  • ROLLBACK *
  • SAVE
  • SET TRANSACTION *

Logical and Comparison Operators

  • ALL *
  • AND *
  • ANY *
  • BETWEEN *
  • EXISTS *
  • IN *
  • IS *
  • LIKE *
  • NOT *
  • OR *
  • SOME *

Set Operators

  • EXCEPT *
  • INTERSECT *
  • UNION *

Join Keywords

  • JOIN *
  • INNER *
  • LEFT *
  • RIGHT *
  • FULL *
  • CROSS *
  • OUTER *

Built-In System and Metadata Keywords

  • @@IDENTITY
  • @@ROWCOUNT
  • @@ERROR
  • @@TRANCOUNT
  • @@VERSION
  • CURRENT_USER *
  • SYSTEM_USER
  • SESSION_USER *
  • USER

Control-of-Flow Keywords

  • BEGIN
  • END
  • BREAK
  • CONTINUE
  • GOTO
  • IF
  • ELSE
  • RETURN
  • TRY
  • CATCH
  • THROW
  • WAITFOR
  • WHILE

Common Table Expression (CTE) and Windowing

  • WITH *
  • OVER
  • PARTITION
  • ROW_NUMBER
  • RANK
  • DENSE_RANK
  • NTILE

Miscellaneous SQL Server–Specific Keywords

  • IDENTITY
  • TOP
  • PERCENT
  • TIES
  • ROWGUIDCOL
  • SPARSE
  • FILESTREAM
  • PIVOT
  • UNPIVOT

Key Takeaways

After completing this tutorial, you now understand and have access to a nearly complete list of SQL Server keywords. Here are some bullet points of what you should have gained from this tutorial.

  • You learned that T-SQL keywords are grouped by purpose, such as DDL, DML, DCL, TCL, operators, joins, and control-of-flow statements, making SQL Server scripts easier to read and understand.
  • You now know which keywords belong to the ANSI SQL standard, marked with an asterisk (*), and which ones are SQL Server–specific extensions. This helps when writing portable SQL code versus SQL Server–exclusive solutions.
  • ou discovered that DDL keywords define and modify database objects, while DML keywords handle inserting, updating, deleting, and retrieving data — the foundation of everyday database work.
  • You learned how DCL and TCL keywords control security permissions and transaction behavior, ensuring data integrity and safe multi-user operations.
  • You saw how logical operators, set operators, and join keywords shape query filtering and result-set construction, which is essential for writing efficient SELECT statements.
  • You were introduced to SQL Server–specific features such as TOP, IDENTITY, PIVOT, and TRY…CATCH, which extend beyond the ANSI SQL standard and provide advanced functionality unique to T-SQL.
  • You now understand why avoiding reserved keywords as object names prevents syntax errors and improves long-term maintainability of your database code.
  • Finally, you gained a reference-style understanding of keyword categories, giving you a practical lookup resource for writing clean, professional, and standards-aware SQL Server code.

Note: I have tried to make as comprehensive a list as possible, so if you notice something missing or out of place, please feel free to contact me and let me know. You can contact me at awlove@tsqlbasics.com