Home Sql Mysql-example SQL Indexes
Questions:Ask|Latest

 
 

Share on Google+Share on Google+

SQL Indexes

Advertisement
SQL uses index to find records quickly when a query is processed. Using Index can drastically enhance the performance of an application.

SQL Indexes

     

SQL uses index to find records quickly when a query is processed. Using Index can drastically enhance the performance of an application.

Understand with Examples

The Tutorial illustrate an example from SQL Indexes. To understand and grasp the example we create a table 'stu' that has the required fieldnames and datatypes respectively.

 

 

 

 

Create Table Stu:

Create table stu(id int, name varchar(10));

Create Index:

The Create Index is used to create index_on_id on table 'stu'.

mysql> CREATE INDEX index_on_id ON stu (id);
Query OK, 3 rows affected (0.06 sec)
Records: 3  Duplicates: 0  Warnings: 0

Insert values into stu:

The insert into keyword is used to add thee records to the table 'stu'.

insert into stu values (1,'komal');
insert into stu values (2,'ajay');
insert into stu values (3,'santosh');

Stu Table:

mysql> select * from stu;
+------+---------+
| id   | name    |
+------+---------+
| 1    | komal   |
| 2    | ajay    |
| 3    | santosh |
+------+---------+
3 rows in set (0.00 sec)
Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: January 23, 2009

Related Tutorials

Ask Questions?    Discuss: SQL Indexes  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com