我想有兩個表:數據庫表造型 - 列繼承
[Table1] [Table2]
id1 id2
createdon createdon
createdby createdby
column1a column2
column1b
可以看到,這兩個表做有「createdon」和「createdby」列。類似的事情與我的其他桌子。有沒有一種方法來建模和實現數據庫表結構的列繼承(就像我會用OOP中的類屬性做的那樣)。從概念上講我的意思:我想創建一個超霸表:
[Supertable]
createdon
createdby
並做出表10和Table20延長超表。這樣我就不必爲每個特定的表創建'createdon'和'createdby'列,因爲它們將從超級表繼承。
[Table10] extends [Supertable] results in wanted [Table1]
id1 createdon id1
column1a createdby createdon
column1b createdby
column1a
column1b
[Table20] extends [Supertable] results in wanted [Table2]
id2 createdon id2
column2 createdby createdon
createdby
column2
所以表10,Table20和Supertabe只是內部RDBMS和Table 1和表2的結構是什麼數據庫用戶看到的決賽桌,當他們訪問數據庫。在MySQL(或任何其他RDBMS)中是否可能這樣?
Postgres支持表繼承。 MySQL不。 –