A primary key is used to uniquely identify each row in a database table. This key might be part of the data record itself (for example, a unique user id) or it can be an extra field that is not really related to the actual data record. A primary key can consist of one or more fields on a table. When multiple fields are used as a primary key, they create a “composite” key. The Key Column properties are provided in the Rdbms Point Query component for designation of a primary (or composite primary) key.
The key columns you define (using the Key Column1 and Key Column2 fields) may not actually be primary keys, although they often will be. If you do not define a key column, the first column in the row is automatically used as the key column. In some situations you may need two or more key columns to specify a unique key. If you need more than the two key column fields provided, you can add another key column slot from the RdbmsPointQuery Slot Sheet view, as shown below.

An example situation where a single column cannot uniquely identify each row in a table might be a table of fan motor types where there is a column for "manufacturer", "model" and "maximum speed". In this case, in order to identify each row you need to look at both the manufacturer and the model. These two columns would be the Key Column1 and Key Column2 columns. Only with both of them can you identify any given row, since individually neither column is unique.
Copyright © 2000-2016 Tridium Inc. All rights reserved.