Is it possible to create links between two or more databases?
Suppose that table A in base A is related to table B , base B.
Is it possible to create links between two or more databases?
Suppose that table A in base A is related to table B , base B.
If you need a foreign key for a field from a table from another database, then yes
CREATE TABLE IF NOT EXISTS database_a.table_a (
ID INT,
ID_REF INT NOT NULL,
FOREIGN KEY ( ID_REF ) REFERENCES database_b.table_b (ID) ON UPDATE RESTRICT ON DELETE CASCADE
);
You can refer to the table in the database using the full name - AA and Б.Б respectively.
Source: https://ru.stackoverflow.com/questions/611755/
All Articles