Home  >  Article  >  Database  >  What are the design specifications for mysql tables?

What are the design specifications for mysql tables?

PHPz
PHPzforward
2023-05-29 19:43:27762browse

1. The number of single instance tables must be controlled within 2,000.

2. The number of sub-tables must be controlled within 1024.

3. The table must have a primary key. It is recommended to use UNSIGNED integer as the primary key.

Potential pitfalls: Deleting a table without a primary key will hang in the library if it is a master-slave architecture in row mode.

4. The use of foreign keys is prohibited. If integrity is to be guaranteed, it should be achieved through the application.

Example

create table class(
    major varchar(16) comment '专业',
    name char(8) comment '班级名',
    nums int comment '人数'
);

The above is the detailed content of What are the design specifications for mysql tables?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete