Purpose of a foreign key name

Asked

Viewed 69 times

0

I am creating tables for a system I am developing and when entering the part of adding foreign key through the interface of PostgreSQL 9.3.17 I noticed you have the field nome to identify this key, I never paid much attention to this and always put the name of the key with the same name as the table column.

The addition screen with the input name is like this:

Imagem ilustrando adição de chave estrangeira

The moment a key is added its name is displayed this way:

inserir a descrição da imagem aqui

  • What is the purpose of the foreign key name?
  • What may entail in the future by neglecting the use of this name?

1 answer

0

  • What is the purpose of the foreign key name?

The intuitive of the foreign key name, is to facilitate the understanding of the relations with other tables.

  • What may entail in the future by neglecting the use of this name?

There are not many problems when neglecting the use of this name, of course, it is a good practice to always use names that facilitate the understanding of the relationship with other tables. To facilitate understanding of another DBA that may be serviced after you, just imagine one example. You create multiple relationships with address table, orders, and customers, and place the foreign key name as ck, pk, te. Of course it is an inappropriate use of foreign key name.

  • You answered me what the purpose of the existence of a foreign key was, but my question was what the purpose of her NAME was.

  • The same occurs for the second question, the question is not the structure of the bank with the use or not of the keys, but rather the correct/due use of the key NAMES.

  • I will correct..

Browser other questions tagged

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