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
1
vote
2 answers

How to iterate in pairs over a list with ODD cardinality in python

I want to iterate over a list pair-wise in Python, except the list has an odd number of elements. I know if this list is even for item1,item2 in zip(alist[0::2],alist[1::2]) would work, but if the list is odd the loop breaks out before it processes…
cdpp
  • 152
  • 2
  • 9
1
vote
1 answer

How to query distinct count distibution in elasticsearch

Cardinality aggregation query calculates an approximate count of distinct values. How we can calculate the cardinality distribution of documents? For example suppose we have: a,a,a,b,b,b,c,c,d,d,e and distinct count distribution is: 3: 2 # count of…
Vahid Kharazi
  • 5,723
  • 17
  • 60
  • 103
1
vote
0 answers

Define Cardinality in OWL across different properties

Is there a way to define the cardinality in OWL across several properties? The usual syntax would be property min number class. I would like to do (property1, property2) min 2 class. Example: I have a sender with several characteristics (Assistance,…
very_interesting
  • 335
  • 1
  • 2
  • 11
1
vote
2 answers

ERD relationship cardinality - Is it better with reverse placement of symbols?

Contrary to traditional convention, could it be better to draw relationship cardinalities attached to the table having the relationships rather than the tables the relationships are with? In other words let the symbols show the nature of the…
Sonlun
  • 45
  • 5
1
vote
1 answer

AWS QuickSight and cardinality

As a Power BI user I know that I can, in the modeling tab when joining two tables, select the cardinality of the relationship (many:one, one:many, many:many, or one:one) and change the direction. I know that you can do joins in QuickSight but is…
1
vote
1 answer

Why would cardinality of an index in a restored table be different from cardinality in the original table?

I'm testing a proprietary tool that dumps a table in a MySQL RDS to the parquet format, and then restores it into another MySQL RDS. Both tables have the same amount of rows: mysql> SELECT COUNT(*) FROM fox_owners; +----------+ | COUNT(*)…
Gromit
  • 101
  • 1
  • 7
1
vote
0 answers

Where to place min cardinality in an ER diagram

I am reading the book Database Processing, 14th Edition. In chapter 5, Min and Max Cardinality are discussed. My question is mainly focused on min cardinality. For example, it is mentioned that a department has one or more employees while employee…
1
vote
2 answers

How to understand the cardinality decreased with the index sequence increasing in MySQL 8

I normally use the MySQL command show index to understand the index efficiency. Here is an index with 16 columns(maximum). show index from the table; Please see the screenshot. enter image description here I find it strange that the Cardinality…
1
vote
0 answers

R: Using mice() to Impute Character/Factor Data w/ Lots of Possible Values

I have a data set with six variables and about 5000 observations (rows). The variables are: year, day_of_week, age, gender, race, state Variables year and age are integers; the rest are factors. This data has some missing values. To replace them,…
JRomeo
  • 171
  • 1
  • 8
1
vote
1 answer

Not null on both sides of One-to-many in PostgreSQL

How are one-to-many relationships implemented? It is often recommended to do something like: CREATE TABLE instructor ( instructor_id integer primary key, ... ); CREATE TABLE course ( course_id integer primary key, instructor_id integer not…
1
vote
1 answer

Azure Data Explorer partitioning strategy

I have a table in Azure Data Explorer that collects data from IoT sensors. In the near future it will collect millions of records each day. So to get the best query performance I am looking into setting a partitioning policy:…
1
vote
0 answers

SQL Server 2014 SP3 Slow query with big difference in Estimated number of rows and Actual number of rows

The below query is running slow and i suspect that the issue is because of a huge difference between Estimated number of rows and Actual number of rows with the SQL Server 2014 SP3. Unfortunately, I am not allowed to create the missing index as…
1
vote
1 answer

How to write a [1..1] and [1..*] relation in xText

I want to define grammar in Xtext for the state machine. My rule is that one state machine must have [1.. * ] transitions, [1..1] initial state, [1..1] final state, and [0.. * ] intermediate states. StateMachine: 'InitialState' initialstate =…
MDE
  • 21
  • 1
1
vote
1 answer

How to control non-fixed cardinality on a relation in Rails?

I'm writting an app that manages appointments to different services. Each service "capacity" is determined by one or more Timetables, meaning that service A may have 2 "desks" form June 1 to June 30 while having only 1 from July 1 to August 31, so I…
1
vote
1 answer

My SQL Database inconsistencies (Cardinality vs. Auto Increment)

I have a problem with my SQL database filled by a C-program using the my SQL connector. The correspondent part of the C-Code which fills the database is displayed below: sprintf(query_table, "CREATE TABLE IF NOT EXISTS `%08X` (COUNTER INT NOT NULL…
DeMikeles
  • 11
  • 1