SQL Data Definition – Objects
This section provides an overview of the primary database objects that can be defined using SQL Data Definition Language (DDL) statements.
On this page
Tables
Tables store data in rows and columns. They are defined with CREATE TABLE and can include constraints such as primary keys, foreign keys, defaults, and checks.
| DDL Statement | Description |
|---|---|
CREATE TABLE | Creates a new table. |
ALTER TABLE | Adds, modifies, or drops columns and constraints. |
DROP TABLE | Removes a table and its data. |
Views
Views are virtual tables defined by a query. They simplify complex queries and can provide security by restricting column access.
| DDL Statement | Description |
|---|---|
CREATE VIEW | Defines a new view. |
ALTER VIEW | Modifies an existing view definition. |
DROP VIEW | Deletes a view. |
Indexes
Indexes improve query performance by providing fast access paths to rows. They can be clustered, non‑clustered, unique, or filtered.
| DDL Statement | Description |
|---|---|
CREATE INDEX | Creates a new index. |
CREATE UNIQUE INDEX | Creates a unique index. |
DROP INDEX | Removes an index. |
Stored Procedures
Stored procedures encapsulate reusable T‑SQL logic. They can accept parameters, return result sets, and manage transactions.
| DDL Statement | Description |
|---|---|
CREATE PROCEDURE | Creates a new stored procedure. |
ALTER PROCEDURE | Modifies an existing procedure. |
DROP PROCEDURE | Deletes a procedure. |
Functions
Functions return a scalar value or a table. They are deterministic and can be used in queries, constraints, and computed columns.
| DDL Statement | Description |
|---|---|
CREATE FUNCTION | Creates a new scalar or table‑valued function. |
ALTER FUNCTION | Modifies an existing function. |
DROP FUNCTION | Deletes a function. |
For detailed syntax and examples, refer to the individual object pages linked in the left navigation.