KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Interpreting the Structure Editor: Many-to-One or Primary Key-Foreign Key?
PRODUCT: 4D | VERSION: 11.3 | PLATFORM: Mac & Win
Published On: April 9, 2009

In 4D v11 SQL, how do you tell if two tables are associated by the traditional 4D Many-to-One relationship or whether the relationship was created by the new SQL constraints of Primary Key - Foreign Key? The Structure Editor provides you with visual clues.

If the developer manually created a relationship between two tables, the structure diagram represents the relationship as shown below:



If the developer applies the Primary Key and Foreign Key relationship when using the SQL CREATE TABLE command, the structure diagram represents the relationship as shown below:



Notice the difference between the "1" and "N" connectors.

In the traditional relationship, the "1" connector is in an arrow and the "N" connector is in a circle.

In the Primary Key - Foreign Key relationship, both the "1" connector and the "N" connector are contained with a small rectangle.

NOTE: The traditional One-to-Many or Many-to-One relationships and Primay Key - Foreign Key relationship are not mutually exclusive. The field can be designated as both, and thus work in the traditional AUTOMATIC RELATIONS as well as with the SQL constraints of Primary and Foreign keys.