I create two tables in sql server as follows:
create table personas
(
id int PRIMARY KEY not null identity,
nombre_persona varchar(24)
)
create table coches
(
nombre_persona int FOREIGN KEY REFERENCES personas(id) ON DELETE CASCADE,
vehiculo varchar(24)
)
insert data:
insert into personas (nombre_persona) values ('juan')
insert into personas (nombre_persona) values ('jose')
insert into personas (nombre_persona) values ('aniceto')
insert into personas (nombre_persona) values ('raul')
insert into coches (vehiculo) values ('mercedes')
insert into coches (vehiculo) values ('seat')
insert into coches (vehiculo) values ('ferrari')
insert into coches (vehiculo) values ('porche')
but when doing the query of the car table I get the values in null, I should put the person to whom each car belongs, not how do I do so that it appears?
select * from coches
nombre_persona vehiculo
NULL mercedes
NULL seat
NULL ferrari
NULL porche