我有三個表格:service_type_1,service_type_2,service_type_3。如何使用外鍵在一個表中存儲不同表的多值屬性?
這些表格有三個常見屬性:id,名稱,image_path。
我想存儲一個以上的photo_path service_type_1表使image_path成爲一個多值屬性。 (這同樣適用於service_type_2,service_type_3表。)
所以,我創建了一個單獨的表稱爲photo_details存儲IMAGE_PATH爲service_type_1通過表外鍵屬性ID連接它。現在的問題是我想用photo_details表來存儲IMAGE_PATH兩個service_type_2和service_type_3也。
有沒有解決方案?
我應該爲service_type_2,service_type_3創建單獨的表嗎?
不,請在'photo_details'表中添加列'type'。其中type = type_1,type_2,type_3 –