The role of the primary key: 1) To ensure the integrity of the entity; 2) speed up the operation of the database 3) when you add a new record to a table, the database automatically checks the primary key value of the new record and does not allow the value to repeat with the primary key values of other records. 4) The database automatically displays the records in the table in the order of the primary key values. If no primary key is defined, records in the table are displayed in the order in which they are entered.
The primary key is not to be unavailable, and can be from:
1. Whether the business requirements are met
2. Data query efficiency (primary key can improve query efficiency, of course, reasonable index substitution can also)
These two angles weigh whether a primary key is required.
This depends on the function of the table. Use to store a large amount of data, and need to query frequently, the establishment of primary key can speed up the query efficiency and reduce the burden on the server. In the absence of this requirement, the establishment consumes more server resources instead.
Setting does not set the primary key to see business or demand
If you are simply working on a single table, it is not necessary.
There is no effect on any table operations that are not associated with multiple sheets.
The primary key is simply an association between a table and a table, and there is an automatic addition of indexes when the primary key is being built, and in some cases it can increase the query speed.
Must there be a primary key for each table in SQL?