Why use primary keys?

What are the primary keys used in addition to identifying a unique column in a table? Could this not be done simply using the auto-increment constraint for the column? I understand that PK and FK are used to link different tables, but can this be done simply by using join?

Basically, what does a database do to improve performance when connecting using primary keys?

+3
source share
6 answers

Mainly for referential integrity with foreign keys. When you have a PC, it will also create an index behind the scenes, and thus you do not need to scan tables when looking for values

+4

. . , , , .

- , . , , , !

+2

- . , FK. - , . , PK , , .

+1

, , , , SQL Server. ( ..)

, .

+1

Microsoft Access, , , SQL Server, , . , Access 2000 SQL Server 6.5. .

+1

, . "" , . , , , . . "", .

( ) .

0

Source: https://habr.com/ru/post/1731056/


All Articles