Database design request: join tables or leave separately?

I am starting to create a database driven website.

I have two identical tables, GPU vendorand CPU vendor. Both have the same columns: id, vendor_name, vendor_url, vendor_bio.

Could you make separate tables or combine them, perhaps by adding a type column?

I do not want my inexperience to interfere with my design later. Think first, do it later! :)

+3
source share
2 answers

YAU outlined the answer. In most cases like yours, I have combined the two tables into one, with a type column to indicate which type each record belongs to.

, . , . GPU , .

, YAU: .

, , , . VENDORS, CPU_VENDORS, CPU GPU_VENDORS, GPU. .

, VENDORS, UNION GPU_VENDORS CPU_VENDORS, .

, .

0

"" . "VENDOR" "VENDOR_TYPE" .

Table Vendor{
    id, 
    vendor_type,
    vendor_name, 
    vendor_url, 
    vendor_bio    
}

Entity, . , , "VENDOR", "GPUVendor" "CPUVendor"

+3

All Articles