2014-11-21 29 views
-1

我有两个表: Student_Info和Student_Academics组合多个表的多个列在Oracle中

以下是在Student_Info列:ID,姓名,性别,地址// ID是主键 以下是在列Student_Academics:SerialNo,Id,Branch,Grade // Id是外键

我想统计性别为女性和分支为CS的学生人数。

我尝试使用连接查询,但它没有提供所需的信息。

+0

显示表定义,数据,查询,您尝试输出和期望的输出。 – philipxy 2014-11-21 20:54:35

回答

0

这应该工作,

select count(1) 
    from Student_Info SI, Student_Academics SA 
where si.id = sa.id 
    and si.gender = 'female' 
    and sa.Branch = 'CS';