How to find relationship and cardinality in MySQL?

2

The image below shows a relationship between two tables created from the MySQL Workbench.

What I need to know is how I can find this information inside the database.

I need to know exactly what type of cardinality (1: 1 or 1: n).

I've already looked into the "information_schema" and I can not find it.

    
asked by anonymous 29.09.2015 / 00:21

3 answers

4

Cardinality (in this context) is not information found within the database. It is a concept we apply in general modeling, to understand how the relationship between tables is.

Generally we refer in these diagrams to the expected cardinality in the relationship. These diagrams are on a more abstract level.

It is even possible to enforce cardinality through the various database features such as stored procedures, constraints, and triggers.

But this does not give an unambiguous information of which is the cardinality, much less it is something obligatory.

    
29.09.2015 / 00:48
1

I know it's 2018, but it's a question I had too and I found the solution. I would like to share with others.

    
24.08.2018 / 02:52
0

You can find the cardinality in MySQL using the SHOW INDEX command.

Example usage:

SHOW INDEX FROM tabela FROM banco;

link

    
29.09.2015 / 00:49