ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Editors / Data model editor / Logical Data Model
  • Overview
  • Simple cardinalities
  • Example of cardinalities
  • Advanced cardinalities
  • Example of advanced cardinalities
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Overview
Cardinalities are used to count the relationships between two data files. There are two types of cardinalities:
These cardinalities are defined in the data model editor.
Simple cardinalities
Cardinalities are defined according to the answers to the two following questions:
  1. For each record found in the data file, what is the minimum number of records in the other file to which this record is linked?
    The answer provides the first part of cardinality (minimum cardinality):
    • if the answer is "none", the cardinality is 0,X.
    • if the answer is "a single one", the cardinality is 1,X.
  2. For each record found in the data file, what is the maximum number of records in the other file to which this record is linked?
    The answer provides the second part of the cardinality (maximum cardinality):
    • if the answer is "a single one", the cardinality is X,1.
    • if the answer is "several", the cardinality is X,N.
The answer to these two questions defines the cardinality that can be: 0,1 ; 0,N ; 1,1 ; 1,N
Cardinalities are essential because they ensure referential integrity in a database.
To put it simply, these two questions can be broken down into four questions. For example, to describe a link between the "Club" file and the "Member" file:
  • each "Club" has at least one "Member": Yes/No?
  • each "Club" can have several "Member": Yes/No?
  • each "Member" has at least one "Club": Yes/No?
  • each "Member" can have several "Club": Yes/No?

Example of cardinalities

This example presents two different cardinalities:
  • 0,1: A person can be a member of a single sport club. This person does not have to belong to a sport club.
  • 0,N: A club can have zero or several members.
Advanced cardinalities
Cardinalities can be defined more precisely. This is referred to as advanced cardinalities.
These cardinalities allow you to specify exactly the minimum and maximum cardinality.
To define the advanced cardinalities, check "Display advanced cardinalities" in the link description. The link description can be displayed:
  • when creating a link.
    Reminder: To create a link, go to the "Analysis" tab, "Creation" group, and select "New link".
  • by double-clicking the representation of a link.

Example of advanced cardinalities

This example presents two different cardinalities:
  • 0,1: A person can be a member of a single sport club. This person does not have to belong to a sport club.
  • 0,10: A club can have from 0 to 10 members.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 01/28/2025

Send a report | Local help