Related Tables: What is it? How is it? What's the use? What justifies its use? [closed]

0

I would like a better explanation of this strategy (if so called) and what makes its use justified since I see some trading systems using it.

Complementing the question:

Well, I had never seen it myself either, I had only heard of it (if I may call it that) until one day I came across a large institution that used this "strategy." I went to do a computer test there and all the analysts only spoke in "affiliate", "affiliated" ... From what I saw (or I understood superficially) it was an index table that served as an identifier for all other system tables from which to do ANY query in the system I would need to join this table ... Maybe a security strategy that justifies the use but I found it extremely unnecessary and redundant.

    
asked by anonymous 21.10.2016 / 05:25

2 answers

1

Hello Vinícius, I have not heard of "linked tables" ... What I see a lot in Database are Tables related.

Each table has its PK (Primary Key), and this primary key can be an FK (Foreign Key from another table.)

Related tables work according to your code.

Much used in large systems (erp), ecommerce, simple systems (stock, sale) and the like.

Example: The CategoryID key of a Category table is an FK in the Products table.

When you list this product, you may see the category as well.

Related tables are of paramount importance for any database in your application.

    
21.10.2016 / 18:51
1

I believe you refer to the correct tables?

The relationship between tables is one of the premises of a relational database (SQL), the construction of tables using relationships helps the location of records that have some reference to a particular record.

For example:

Imagine the situation of a sale, for example, if you do not use relationship between tables, your table venda would have to have all the data pertinent to it, ie.

Imagine that Lucas salesman made 5 sales. Quite simply, you'd have something like this:

Notethatifthesalespersonmakes1000salesforthesamecustomer,theinformationwillberepeated1000times,inadditiontoincreasingtheriskofinconsistentdata.(IcantypeLucasinonefield,Lucasinanother,Lucasdinanother)etc...

Forwhattherelationshipisfor.

Youassignanidentifierforeachrecord,andeverytimeyouuseit,youusethereferenceofthatrecord.

The id field would be what we call the primary key, a unique identifier for that record (it does not have to be an integer, you can use any field or set of fields to identify a record)

When we point to a primary key that is in another table, this key is referred to as a foreign key, (for the sake of understanding, the relationship is usually created, and rules are assigned for that key foreign).

Well, by the way, I believe there's only sense in using a relational database if you're going to use relationships.

If your application does not need relationships, or you do not intend to use the relationships, I think it would be more advantageous to use non-relational (so-called NoSql) banks.

    
21.10.2016 / 19:38