Answer the question
In order to leave comments, you need to log in
Whether there is a sense vysheat foreign key for ER when all requests on pure SQL?
Since so many joins and so on go straight, that is
SELECT column_name(s)
FROM table1
INNER JOIN table2
ON table1.column_name = table2.column_name;
FOREIGN KEY (PersonID) REFERENCES Persons(PersonID)
class User{
// foreign key post.owner_id on user.id
public $posts;
// foreign key comments.owner_id on user.id
public $comments;
}
$query->(User::class)->join(Post::class)
Answer the question
In order to leave comments, you need to log in
the foreign key is needed for what it is intended for. to guarantee referential integrity. the increase in the speed of sampling when linking tables is due to the index, which is created when a foreign key is specified.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question