I have a Staff table with the following structure:
create table PERSONAL
(
personal_id NUMBER(8) not null,
nombre VARCHAR2(50),
apellido VARCHAR2(50),
)
alter table PERSONAL
add constraint PK_ID primary key (PERSONAL_ID);
And a table of places in the following way:
create table LUGAR
(
lugar_id NUMBER(8) not null,
desc_lugar VARCHAR2(50),
latitud VARCHAR2(50),
longitud VARCHAR2(50)
)
alter table LUGAR
add constraint LU_ID primary key (LUGAR_ID);
I also have a table that links the staff with the places:
create table LUGAR_PERSONA
(
lugar_id NUMBER(8) not null,
personal_id NUMBER(8) not null
);
alter table LUGAR_PERSONA
add constraint FK_lugar FOREIGN KEY (lugar_id) REFERENCES lugar(lugar_id)
add constraint FK_personal FOREIGN KEY (personal_id) REFERENCES personal(personal_id);
Well the question is: How do I make a query to the Place table per person to bring me the related data of the personnel and places of the corresponding id?
Greetings