我正在创建一个包含多个表的简历数据库。有一个简历表,包括(姓名,地址等),学位表,包括(学校,毕业年,gpa等)一个employment_history表,包括(以前的工作等)和参考表,包括(参考,电话#等)以下是表格。现在您可能知道,一个人可能有多个学位或多个参考。我有这些表中的数据,我有一个有效的查询。但是因为我有一个有多个度数的人,所以它为那个人打印出4行
Select *
from Resume AS res, degrees AS deg , Employment_History AS eh
WHERE deg.FK_RESUME_ID = res.ID_NUMBER AND eh.FK_RESUME_ID = res.ID_NUMBER;
然后返回
正如您在结果图片中看到的那样,结果打印出4行,但所有数据都属于那个人(相同的id)。我正在尝试创建一个查询,打印出所有表中的所有人信息,但只打印1行,而不是多行
create table resume (
ID_NUMBER bigint generated by default as identity (start with 1),
VERSION_ID bigint default 0 not null,
address varchar(50),
city varchar(30),
state varchar(2),
zip_code varchar(5),
first_name varchar(30),
last_name varchar(30),
best_phone varchar(11),
email_address varchar(50),
objective_note varchar(150),
primary key (ID_NUMBER)
);
create table degrees (
ID_NUMBER bigint generated by default as identity (start with 1),
VERSION_ID bigint default 0 not null,
School varchar(50),
degree_type varchar(5),
major varchar(30),
grad_month varchar(9),
grad_year varchar(4),
gpa varchar(5),
fk_resume_id bigint not null,
FOREIGN KEY (fk_resume_id) references resume (ID_NUMBER),
primary key (ID_NUMBER)
);
create table reference (
ID_NUMBER bigint generated by default as identity (start with 1),
VERSION_ID bigint default 0 not null,
first_name varchar(30),
last_name varchar(30),
best_phone varchar(11),
email_address varchar(50),
fk_resume_id bigint not null,
FOREIGN KEY (fk_resume_id) references resume (ID_NUMBER),
primary key (ID_NUMBER)
);
create table employment_history (
ID_NUMBER bigint generated by default as identity (start with 1),
VERSION_ID bigint default 0 not null,
company varchar(50),
title varchar(30),
duties varchar(100),
start_month varchar(9),
start_year varchar(4),
end_month varchar(9),
end_year varchar(4),
fk_resume_id bigint not null,
FOREIGN KEY (fk_resume_id) references resume (ID_NUMBER),
primary key (ID_NUMBER)
);