Creating A MySQL Composite Index

An index can be created in one or more columns. IF the number of columns included in an index is greater than one it’s known as a: Composite index

Composite index:

An index created on multiple table data columns is called a composite index as shown in Diagram 1.
The following is the syntax for creating composite index.

Syntax:
<System prompt> CREATE INDEX <IndexName> ON <Table Name> (<Column Name1>, <Column Name2>);

Example:
mysql> CREATE INDEX product_id ON productdetail (Serial_NO, ID);

diagram1.gif
Diagram 1

Subscribe Now


  • Smileys
  • :confused:
  • :cool:
  • :cry:
  • :laugh:
  • :lol:
  • :normal:
  • :blush:
  • :rolleyes:
  • :sad:
  • :shocked:
  • :sick:
  • :sleeping:
  • :smile:
  • :surprised:
  • :tongue:
  • :unsure:
  • :whistle:
  • :wink:
 
  • 5000 Characters left
   
 

Here are some great bonus tutorials for you.

Apache (10)    |   PHP (40)    |   MySQL (70)  

JavaScript (40)    |   Ajax (20)    |   SEM (20)    |   SEO (20)

Purchase Our Joomla 2.5.X eBook

Joomla EBook Picture

Setup Your Joomla 2.5.X Website From Scratch

By Ivan Bayross Cost USD 4.50/- only

Buy Now

160 pages packed with immediately usable information

Freebies worth 250 USD/- come with this purchase

Content

Just Ask Us

We reply in 24hours.