-1

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 张图片

  1. 创建一个包含以下内容的结果集:

    Pk_category_id,
    category_name,
    Pk_project_id,
    project_name,
    Pk_Picture_id,
    Picture_name,
    Pk_Album_id,
    Album_name

  2. 过滤结果集以显示所有项目和所有相册以及与相册对应的一张图片

  3. 过滤结果集,显示所有项目,并显示一个项目对应的一张图片和一张相册
4

2 回答 2

-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;
于 2013-09-19T08:12:39.117 回答
-1

过滤结果集以显示所有项目和所有相册以及与相册对应的一张图片

` select p.vchr_project_name,a.vchr_album_name,pr.vchr_picture_name from tbl_projects p,tbl_project_album A,tbl_picture pr where p.pk_int_project_id=a.fk_int_project_id and a.pk_int_album_id=pr.fk_int_album_id group by a.vchr_album_name ;

于 2013-09-23T18:21:38.317 回答