SQL tutorial | Interview questions | Oracle
Would you like to react to this message? Create an account in a few clicks or log in to continue.

How To Create a Table Index?

Go down

How To Create a Table Index? Empty How To Create a Table Index?

Post by Micheal Sat Jan 16, 2010 9:29 pm

If you have a table with a lots of rows, and you know that one of the columns will be used often a
search criteria, you can add an index for that column to in improve the search performance. To
add an index, you can use the CREATE INDEX statement as shown in the following script:
CREATE TABLE tip (id NUMBER(5) PRIMARY KEY,
subject VARCHAR(80) NOT NULL,
description VARCHAR(256) NOT NULL,
create_date DATE DEFAULT (sysdate));
Table created.
CREATE INDEX tip_subject ON tip(subject);
Index created.

Micheal
Admin

Posts : 243
Join date : 2010-01-10

http://sql-tutorial.co.cc

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum