Why do I need to use foreign key if I can use WHERE?

前端 未结 10 1418
难免孤独
难免孤独 2020-12-23 16:34

A beginners\' question about foreign key in MySQL.

In w3school it says,

A FOREIGN KEY in one table points to a PRIMARY KEY in another table.<

10条回答
  •  无人及你
    2020-12-23 17:33

    The primary purpose of a WHERE clause is to limit the rows returned by the query. See SELECT Syntax.

    Primary key/Foreign key relationships maintain referential integrity and with proper indexing increase the performance of queries. (See Pete OHanlon's explanation, above and JOIN Types)

提交回复
热议问题