Related tables: What is it? What is it? What is it for? What justifies its use?

Asked

Viewed 209 times

0

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

Supplementation of the question:

Well, I had never seen it myself, I had only heard of it (if I may call it that way) until one day I came across a great institution that used this "strategy". I went to do a computer test there and all the analysts were talking about was "related", "related"... From what I saw (or understood superficially) it was an index table that served as an additional identifier for all other tables of the system from which to make ANY query in the system I would need to give a Join in this table... Perhaps a security strategy that justifies the use but found extremely unnecessary and redundant.

  • I believe you are talking about a table called "related" and not a bank strategy. There was a mix-up. Programs such as TOTVS use a table called "related" to separate the records between the branches of the company that is using the system. JOIN with the table coligada to be able to separate the affiliate or "affiliate" data you want. see only some links of the manual https://goo.gl/RSBNp6 http://wikihelp.totvs.com.br/WikiHelp/FOP/Fop.CopiaTabCalcColigadas.aspx

2 answers

1

Hello Vinicius, I haven’t heard of "related tables"... What I see a lot in Database are Related Tables.

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

The related tables work according to your code.

Widely used in large systems(Erp), Ecommerce, simple systems(stock, sale) and the like.

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

When you list this product you can also display the category.

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

  • Well, I had never seen it myself, I had only heard of it (if I may call it that way) until one day I came across a great institution that used this "strategy". I went to do a computer test there and the analysts only talked about "related", "related"... From what I saw (or understood superficially) it was a table of indexes that served as an additional identifier for all other tables in the system. To make a query I would need to give a Join in this table. Maybe a strategy of...

1

I believe you refer to the correct related 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 given record.

For example:

Imagine the situation of a sale for example, if you don’t use relationship between tables, your table venda it would have to have all the relevant data to it, that is to say.

Imagine the salesman Lucas made five sales. In a very simple way, you would have something like this:

Tabela 1

Note that if the seller makes 1000 sales to the same customer, the information will be repeated 1000 times, and increase the risk of inconsistency in the data. (I can type Lucas in one field, Lucasd in another) etc....

That’s what relationships are for.

You assign an identifier to each record, and whenever you use it you use the reference to that record.

Tabela 2

The field id would be what we call the primary key, a unique identifier for that record (does not need to be an integer number, 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 (Foreign key), (for the purpose of understanding, the relationship is usually created, and rules are assigned to this foreign key).

Well, in conclusion, I believe there’s only sense in using a relational database if you’re going to use relationships.

If your application doesn’t need relationships, or you don’t intend to use relationships, I think it would be more advantageous to use non-relational databases( the so-called Nosql).

  • That is not what I am talking about, but thank you very much for your reply.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.