• Overview
  • Unique key
  • Key with duplicates
  • Simple key or composite key
WinDevWebDev-服务器代码WebDev-浏览器代码WinDev Mobile报表和查询
WindowsLinuxWindows MobileWindows PhoneWindows Store appsAndroidAndroid Widget iPhone/iPad
HFSQLHFSQL Client/Server存储过程HF 5.5OLE DBODBC本地访问

The keys are specific items of your analysis. These items are used to:
  • easily identify the records. For example, in a Product file, the reference of the product is used to identify the product. This reference is unique for each product.
  • organize the data stored in a data file. For example, a key defined on the Name item of Customer file will allow you to quickly sort the records found in the data file by name.
Several types of keys can be defined in a data file

Unique key
A unique key is a key for which a single value can exist in the data file.

For example, in a "PRODUCT" file, each product is identified by a unique reference. The "REFERENCE" item must be a unique key.

Note: If no item can be used as unique key, use an "automatic identifier" item. For each record, the value of this item will be a unique integer.

Key with duplicates
A key with duplicates is a key for which several identical values can be found in the data file.

For example, in the "CUSTOMER" file, a key with duplicates can be defined on the "NAME" item. The content of this key can be same in different records (homonyms). This key enables you to perform a search on the customer name.

Simple key or composite key
A simple key is a key defined on an item.

A composite key is used to define a key on several items of the same data file. This key will be used to access the records of the data file according to the combined value of two items.

For example, to simplify the search for orders, you can define a composite key containing the "Customer Number" item and the "Order Date" item.