Questions tagged [cardinality]

In data modeling, the cardinality of one data table with respect to another data table is a critical aspect of database design. Relationships between data tables define cardinality when explaining how each table links to another. In the relational model, tables can be related as any of: many-to-many, many-to-one (rev. one-to-many), or one-to-one. This is said to be the cardinality of a given table in relation to another.

In data modeling, the cardinality of one data table with respect to another data table is a critical aspect of database design. Relationships between data tables define cardinality when explaining how each table links to another.

In the relational model, tables can be related as any of: many-to-many, many-to-one (rev. one-to-many), or one-to-one. This is said to be the cardinality of a given table in relation to another.

Wikipedia article

274 questions
3
votes
1 answer

distinct count is greater than doc_count in elasticsearch aggs

I wrote some aggs query to get total(sum) and unique count. but the result is a little confused. unique value is greater than doc_count. is it possible? I know that cardinality aggs is experimentall and can get approximate count of distinct…
Jihun No
  • 1,201
  • 1
  • 14
  • 29
3
votes
2 answers

Elasticsearch Terms or Cardinality Aggregation - Order by number of distinct values

Friends, I am doing some analysis to find unique pairs from 100s of millions of documents. The mock example is as shown below: doc field1 field2 AAA : BBB AAA : CCC PPP : QQQ PPP : QQQ XXX : YYY XXX : YYY MMM : NNN 90% of the document contains an…
Deepak
  • 214
  • 1
  • 2
  • 9
3
votes
2 answers

Entity Relationships - Can a weak entity take part in a 'one to many' relationship as the 'one'

With the following entity relationship structure I'm struggling to figure out if the relationship between the LOAN and ITEM entities is valid? The weak entity of LOAN uses a partial key of 'loan_dateLeant' and the primary keys from CUSTOMER and ITEM…
user271132
  • 157
  • 1
  • 4
  • 9
3
votes
1 answer

Cypher relationship cardinality

Is there any way to do a cypher query that returns only the outgoing relationship with cardinality of 1, in neo4j 1.9.7? e.g N2 ----> N4 -----> N10 | |-------> N9 | |------> N5 -----> N9 | |------> N6 -----> N9 In a structure like this i…
Ancelot182
  • 149
  • 1
  • 7
3
votes
1 answer

Protege exactly 1 cardinality OWL restriction not raising an inconsistency

I think I am going crazy! I have followed the various tutorials for Owl and Protege and still cannot figure out the answer. Use case is simple. I have defined a class called ‘Person’. I have defined a data property called hasFirstName. I have added…
Alex
  • 43
  • 3
3
votes
1 answer

MongoDB- Compound shard key using three values

I am creating a collection which stores JSON object using MongoDB. I am stuck in Sharding part. I have an Case ID,Customer ID and Location for each of the record in the collection The Case ID is a 10 digit number (only number and no alphabets). The…
Timothy Rajan
  • 1,947
  • 8
  • 38
  • 62
3
votes
1 answer

Why does an index on a datetime column have low cardinality in MySQL?

I have a table with over 18M rows that is growing quickly. I created a composite index on a datetime column (millions of unique values), intColumn 1 (with about 40k unique values, intColumn 2 (with about 3k unique values) and intColumn 3 (with 1k…
3
votes
2 answers

Which column to put first in index? Higher or lower cardinality?

For example, if I have a table with a city and a state column, what is the best way to use the index? Obviously city will have the highest cardinality, so should I put that column first in the index, should I put state or doesn't it matter much?
Brett
  • 19,449
  • 54
  • 157
  • 290
2
votes
1 answer

Is there a straightforward way to determine the cardinality of a foreign key relationship using SMO?

Using SMO, I'm trying to determine the cardinality of ForeignKey relationships between tables in a SQL Server database. I could peruse each ForeignKeyColumn and look at each Column in the parent (and possibly also referenced) Tables, and look at…
Dave Clemmer
  • 3,741
  • 12
  • 49
  • 72
2
votes
1 answer

ZSH completion - Multiple items per argument

I am attempting to write a completion plugin for YunoHost. I am struggling with the following case, where an argument, optional or not, can take multiple values: ynh app addaccess apps [apps ...] [-u [USERS [USERS ...]]] Typical usage: ynh app…
Buzuck
  • 23
  • 3
2
votes
2 answers

How to deal with changing cardinality in sci-kit learn model

I am trying to use a high cardinality feature (siteid) in a sci-kit learn model and am using get_dummies to one-hot encode this feature. I get around 800 new binary columns which returns a decent accuracy using logistic regression. My problem is…
2
votes
1 answer

Interpreting a primary key from table data

I have a legacy database imported into sql server 2008 r2 that contains no indexes and no primary/foreign keys for hundreds of tables (some with hundreds of columns). The primary keys which I've identified manually (some are composite) are usually…
Scott Mackay
  • 1,194
  • 10
  • 34
2
votes
1 answer

exist-db cardinality for parameter

I am new in exist-db and XQuery. In exist-db I have this site map: The catalog "registranten" contains the catalog "data" (with xml-files) and the two files "regBasic.xql" and "regSearch.xql". I am trying to search in the xml-files using the script…
KSR
  • 29
  • 4
2
votes
2 answers

min cardinality not working as expected in Protege

I'm a beginner in Protege / OWL and I'm having trouble understanding why max cardinality is working and min cardinality is not. I tried Hermit Pellet and Fact as reasoners. I know about the Open World Assumtion, but this seems not logical to me. I…
2
votes
1 answer

Create sets of minimal cardinality from set of pairs

I have a set of pairs of IDs like (123;1765) (1212;8977)... I need to separate those pairs into n groups with an inividual size (number of pairs) each. Those sets should have minimum cardinality (=there should be as few as possible different ids in…
dvs23
  • 127
  • 10