Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: can a index consist of 3 columns (Oracle newbie)

Re: can a index consist of 3 columns (Oracle newbie)

From: Atta ur-Rehman <atta707_at_my-deja.com>
Date: Tue, 19 Sep 2000 04:50:26 GMT
Message-ID: <8q6rac$d7e$1@nnrp1.deja.com>

as you said (entity_code, version_index, sector_code) columns are used to identify each row in the table, these three columns, then, make a composite primary key for the table. I'm just wondering if by an index you mean a primary key. anyway primary keys are always have a associated unique index with them. so create a primary key on the table, and hence a composite unique index on the given three cols do:

alter table article
add primary key(entity_code, version_index, sector_code);

this command would create a primary key for your table, if the existing data doesn't violate the primay key constraints. if you're interested in [unique] index then:

create [unique] index your_index_name
on article(entity_code, version_index, sector_code);

hope that helps.

:) ATTA In article <ssd5rebkqldp14_at_corp.supernews.com>,   mr_oatmeal <mr_oatmeal_at_hotmail.com> wrote:
> Hey All,
>
> We don't have a DBA here, so i've been trying to figure things out on
 my
> own....
>
> I need to add an index to a table--article. In order to find a
 unique row
> you have to query based on 3 columns (entity_code, version_index,
> sector_code), all of them are varchar2. What would be the best way
 to
> index this table. The table has about 100,000 rows.
>
> table: article
>
> entity_code varchar2
> version_index varchar2
> sector_code varchar2
> other_column
> other_column
>
> Thanks,
> mr_oatmeal
>
> --
> Posted via CNET Help.com
> http://www.help.com/
>

--

getting the meanin' of data...


Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Mon Sep 18 2000 - 23:50:26 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US