Quote:
Originally Posted by CrimsonK
Is this bad that I came up with the same amount of tables as I did entities?
|
no, usually you have more tables than entities (e.g. a relationship table between two entity tables, to implement a many-to-many relationship)
Quote:
Originally Posted by CrimsonK
How would you handle creating a table in which one of it's columns needs to refer to two similar but different tables.
|
using a supertype/subtype structure
Tables
vehicle (vehicle_no PK, driver) -- supertype
truck (vehicle_no PK/FK, engine, wheels, other truck columns) -- subtype
car (vehicle_no PK/FK, engine, wheels, other car columns) -- subtype
race (race_no PK, race_name, vehicle_no FK, race_date, location)