I
I
Ivan Melnikov2018-03-13 14:11:26
MySQL
Ivan Melnikov, 2018-03-13 14:11:26

How to organize a self-replenishing lookup table in MySQL?

There is a main table, and it has an address field. Addresses are often repeated. You can create a parent lookup table, Address, and in the main table, a foreign key address_id that refers to the id field in the Address table. Everything would be fine, but only new addresses can be added from time to time. To do this, you will have to manually add a new address to the Address table, after which adding an entry to the main table will become possible. It's a hemorrhoid, to be honest.
Is it possible to auto-complete a lookup table using MySQL 5.7?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
L
Lazy @BojackHorseman MySQL, 2018-03-13
Tag

no.
How is it that the addresses often match? my address, for example, only matches my wife's address

A
Alexander Aksentiev, 2018-03-13
@Sanasol

What does manually mean? Why is it impossible to check the presence of an address in the directory when creating an entry, and if it is not there, then create it immediately?

A
Alexander null, 2018-03-13
@snikes

Triggers, when inserting into a table where there are many addresses, we saw a trigger that tries to insert the address into the reference table, but the address field must be unique there, that's all, even if the address is repeated, it will not be inserted as a new record

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question