Reputation: 775
Let's say I've got tables like:
CARS:
columns: "id", "description"
TRUCKS:
columns: "id", "description"
Both tables got primary keys on field "id".
Is it possible to make sth like one 'common', 'combined' key to both of the tables at the same time... the issue is I need to have both "id" unique, i.e. when I had added TRUCKS: 1, 2, 3, 4..... then adding CARS I need to start from id 5...6,7,8,etc
Upvotes: 0
Views: 116
Reputation: 767
Table vehicle
id
Table car
id
id_vehicle
description
Table truck
id
id_vehicle
description
OR (better? - depends what is Your goal)
Table vehicle
id
id_vehicle_type
description
Table vehicle_type
id
name
vehicle_type(s): (1,car), (2,truck)
Upvotes: 1