Home

SQL Operations: INDEX

 

Introduction

An index is a technique of setting a rule that must be respected with regards to records, especially during data entry. Here is an example:

 
-- =============================================
-- Create index basic template
-- =============================================
USE Exercise1;
GO

CREATE TABLE dbo.Employees
(
    EmployeeNumber integer NOT NULL, 
    FirstName varchar(50) NULL,
    LastName varchar(50) NOT NULL,
    HourlySalary decimal(6, 2) 
)
GO

CREATE INDEX IDX_EmployeeNumber
ON dbo.Employees(EmployeeNumber);
GO

Home Copyright © 2009-2011 FunctionX.com