Hello. How to connect the left table with a group of 3 tables on the right?
Only now it turns out to connect the method presented in the 2nd image
For example, a user selects a specific make, model, and generation of a car, and his choice (make, model, generation) needs to be written to another table.
create table CarBrend( [BrendID] int identity (0,1) not null, [Title] nvarchar(max) not null, constraint PK_BrendID primary key ([BrendID]) ) create table CarModel( [ModelID] int identity (0,1) not null, [BrendID] int not null foreign key references CarBrend([BrendID]), [Title] nvarchar(max) not null, constraint PK_ModelID primary key ([ModelID]) ) create table CarGeneration( [GenerationID] int identity (0,1) not null, [ModelID] int not null foreign key references CarModel([ModelID]), [Title] nvarchar(max) not null, [StartProduction] date not null, [EndProduction] date not null, constraint PK_GenerationID primary key ([GenerationID]) ) create table Car( [CarID] int identity (0,1) not null, [BrendID] int not null foreign key references CarBrend([BrendID]), [ModelID] int not null foreign key references CarModel([ModelID]), [GenerationID] int not null foreign key references CarGeneration([GenerationID]), constraint PK_CarID primary key ([CarID]), ) I doubt the correctness of the 4th table (Car). Tell me what to do in this case.
The first CarBrend table contains the Nissan car brand (and other brands). The second CarModel table contains the Nissan Primera model (and other models). The third CarGeneration table contains all generations of Nissan Primers - P10, P11-120, P11-140, P12 (and others). And in the Car (4) table, entries from all 3 previous tables are combined (to form a complete car).