tbl_category
pk_int_category_id,
vchr_category_name
tbl_projects
fk_int_category_id,
pk_int_project_id,
vchr_project_name,
vchr_project_description,
bln_project_status
tbl_project_album
pk_int_album_id
fk_int_project_id
vchr_album_name
vchr_album_description
tbl_picture
fk_int_album_id,
pk_int_picture_id,
vchr_picture_name,
vchr_picture_description,
vchr_picture_path
将数据插入表格 2类c1和c2, 输入2个或3个项目,对应每个类别。 c1p1,c1p2,c2p1,c2p2等。 每个项目应至少有2张专辑,每张专辑最少2张图片
创建一个包含以下内容的结果集:
Pk_category_id,
CATEGORY_NAME,
Pk_project_id,
PROJECT_NAME,
Pk_Picture_id,
Picture_name,
Pk_Album_id,
ALBUM_NAME
过滤结果集,以便显示所有项目以及所有相册和与相册对应的一张图片
答案 0 :(得分:-1)
select c.pk_int_category_id ,c.vchr_category_name,p.pk_int_project_id,p.vchr_project_name,pr.pk_int_picture_id,pr.vchr_picture_name,a.pk_int_album_id,a.vchr_album_name
from tbl_category c,tbl_projects p,tbl_project_album a, tbl_picture pr
where c.pk_int_category_id=p.fk_int_category_id and p.pk_int_project_id=a.fk_int_project_id and a.pk_int_album_id=pr.fk_int_album_id;
答案 1 :(得分:-1)
过滤结果集,以便显示所有项目以及所有相册和与相册对应的一张图片
` 从tbl_projects p,tbl_project_album A,tbl_picture pr中选择p.vchr_project_name,a.vchr_album_name,pr.vchr_picture_name,其中p.pk_int_project_id = a.fk_int_project_id,a.pk_int_album_id = pr.fk_int_album_id group by a.vchr_album_name;