Join_equal_values

relational-functions join_equal_values

syntax

  • join_equal_values(AtoX_rel, BtoX_rel)

definition

join_equal_values(AtoX_rel, BtoX_rel) results in a uint32 domain-unit that represents each combination of AtoX_rel and BtoX_rel that relate to the same X.. The function results in three subitems being attributes of this domain:

  • first_rel (FKA nr_1_rel): the index-numbers of each row in A that participates in a combination of rows that have the same X-values as rows in B.
  • second_rel (FKA nr_2_rel): the index-numbers of each row in B that participates in a combination of rows that have the same X-values as rows in A.
  • X_rel (FKA nr_X_rel): the equal value in the combination

The explicit: join_equal_values_uint64, join_equal_values_uint32,join_equal_values_uint16 and join_equal_values_uint8 functions can be used in the same manner as the join_equal_values function, to create a new domain unit with an explicit value-type.

applies to

  • AtoX_rel: a uint32 relation
  • BtoX_rel: a uint32 relation

conditions

  1. The values-unit of the argument: AtoX_rel and BtoX_rel must match and represent a valid domain X.
  2. The domain unit of arguments: AtoX_rel and BtoX_rel must be zero based.

see also

  • https://en.wikipedia.org/wiki/Pullback_(category_theory)
  • https://www.w3schools.com/sql/sql_join_inner.asp

example

unit<uint32> RegionCity := join_equal_values(region/country_rel, city/country_rel);
first_rel second_rel nr_X_rel
0 1 0
1 1 0
2 0 1
3 0 1
4 2 2

domain CityRegionCombinations , nr of rows = 5

region/country_rel
0
0
1
1
2

domain region, nr of rows = 5

city/country_rel
1
0
2

domain city, nr of rows = 3

see also