main logo
Subject: AW: Where did 'Unique' index type go to?
Author: "Juergen Wondzinski"
Posted: 2004/04/30 09:38:22
 
View Entire Thread
New Search


Hi,

A UNIQUE index is/was the dBase way of doing a SELECT DISTINCT.
Unfortunately, the name "unique" implies something like the Primary Index to
most uneducated users, therefor MS decided to remove that index from the
Dropdown.

Examples for the usage? Easy:

USE Customers
Index on country unique to temp.idx
Browse fields country

Shows each country one time. Similar to :
SELECT DISTINCT Country FROM Customers ORDER BY Country.

------
A more sophisticated usage for deduping data. Imagine you get a whole bunch
of addresses from various sources and just append them all into one big dbf.
You now ave to get this data to keep only one record for any address.

SET DELE OFF
USE TheBigTable
DELETE ALL
INDEX ON Name + city + street UNIQUE to Temp.idx
RECALL ALL
BROWSE

The trick is, that the Unique index processes only the very first occurence
of the duplicate records, which then gets recalled. All other duplicates
stay deleted and can get packed etc.


There are several other usages for UNIQUE, some of them provide a much
higher performance than the usual SQL variants. But I agree: UNIQUE is
nothing you wouldadd permanently to a table. It's for one-time-usage only.



 Servus

    wOOdy

 |\_/| ---- ProLib - programmers liberty -----------
 (.. ) Our MVPs make the Fox run... See us
  - /  at www.prolib.de or www.AFPages.com
---------------------------------------------------
Message entirely written using recycled electrons!
---------------------------------------------------






 
©2004 Juergen Wondzinski
<-- Prior Message New Search Next Message -->