freshers/Experienced Dotnet jobs

17/07/2011

INDEX Statement

  • Indexes are used to search/query the data from the table, without reading the entire table.
Advantages:-
  1. Allows the application to find the data fast from database thereby increasing the query speed.
 Disadvantages:-
  1. updating the table with an index takes more time when compared to table without index.so,create indexes on columns only which are frequently used/queried.     
SYNTAX:--

CREATE INDEX index_name ON table_name (column_name1,[column_name2],[column_name3],.....)
              
Ex:-                   
  1.  CREATE INDEX person_index ON employees (firstname)
  2.  CREATE INDEX person_index ON employees (firstname,lastname)  //If we you want to create    INDEX on combination of columns

No comments:

Post a Comment