如何设计具有多个 DTO 的数据库 table

How to design a DB table with multiple DTOs

我有两个DTOs:

RedCatDTO {
 color: string,
 someSpecialAttribute: string
}

BlueCatDTO {
 color: string,
 someSpecialAttribute: string
}

如何设计数据库 table 并存储这两个 DTOs

SQL

CREATE TABLE CAT {
 color varchar(24),
 attribute varchar(24),
}

JAVA

public class Cat{
  String color;
  String attribute;
}
public class BlueCat extends Cat{
  String color = blue;
}

或者你可以直接说

Cat blueCat = new Cat();
blueCat.setColor("blue");

请注意这是粗略的代码,因此您需要研究如何创建 table 等