Skip to content

CLUSTERED

CREATE TABLE Orders
(
OrderID int PRIMARY KEY CLUSTERED,
OrderNumber int NOT NULL,
CustomerName varchar(255) NOT NULL,
OrderDate date
);
Commands executed successfully.

The given SQL statement creates a new table named Orders with OrderID, OrderNumber, CustomerName, and OrderDate fields. The OrderID field is defined as the primary key and it is clustered. In SQL Server, a clustered index determines the physical order of data in a table, thus the table data rows are sorted and stored in order according to the clustered index. Here, the OrderID field is the clustered index of the Orders table.