Indexes

Indexes in the database has the same function as of index page in the directory means its makes searching easy and fast. But in the database indexes should be implement carefully as bad indexes may increase the insertion, updation and deletion time.

Indexes: Syntax

CREATE [UNIQUE] INDEX <index_name>
on <table_name> (
<column_name_1>,
<column_name_2>,
<column_name_N> );

For ex:

CREATE UNIQUE INDEX  Employee_uk1
on Employee (
name,
birth_date,
gender );

here
<table_name> is the name of the table, and<column_name>
UNIQUE is an optional keyword that is used for ensuring unique values in the table.
is the name of a column.
<index_name> is the name of the index,

No comments:

Post a Comment