Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

indexes and keys

Status
Not open for further replies.

jiminy

Technical User
Jan 26, 2002
30
US
Definitions please:
What is the difference between a composite index, composite key, vs primary + secondary index.
Is creating a composite key as simple as defining 2 fields as keys? I haven't seen any good how-to references on this.
 
Definitions please:
What is the difference between a composite index, composite key, vs primary + secondary index.
Is creating a composite key as simple as defining 2 fields as keys? I haven't seen any good how-to references on this.

Composite key consists of the FIRST n fields of a TABLE.

Composite index consists of the FIRST n fields of a SECONDARY INDEX (although technically they could also be the first n fields of the table).

Primary index would be the first n fields of a table.

Secondary indexes are defined on the Indexes tabs of a table structure dialog (or in code, of course). 2ndary index fields do NOT have to be the first fields in the table, nor do they need to be contiguous (next to each other) in the table.

Composite key? Yes, but the fields must be next to each other in the table (you said key, not index). Most recommend against it if possible; use a meaningless integer system instead (NOT an AutoIncrement field! - roll your own or borrow one of those found easily on the various other newsgroups out there (pnews, for instance)).

Tony McGuire
Stop Rob Bennett - "It's not about having enough time; we have the rest of our lives. It's about priorities.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top