关系表SQL Plus

时间:2014-05-15 09:44:05

标签: sql oracle

(1) Create a relational table TOTAPPS(anum,totap) that contains information 
about the numbers of applicants (anum) and the total number 
of applications (totap) submitted by each applicant. If an applicant submitted 
no application then a value ofattribute   
totap should be equal to zero. Load data to a relational table TOTAPPS.

所以我只想了解关系表没有使用以下查询

CREATE TABLE test_table ( anum INTEGER, totap INTEGER );

如何指出anum使用关系表计算申请人数

示例我的申请人表格如下:

//Applicant
A# 
---------
1 
2 
3
4
5

//Application
A#         POSITION
--------------------
1            CEO
1            GM
2            DIRECTOR
3            MANAGER

所以当我选择SELECT * FROM TOTAPPS时,以下结果应该是这样的:

//TOTAPPS
ANUM          TOTAP
-------------------
  1             2
  2             1
  3             1
  4             0 
  5             0

我必须手动插入或当我创建关系表时我可以直接计算它吗?

0 个答案:

没有答案