Sei sulla pagina 1di 5

MIS 6326 (Database Management)

Assignment 1: Chapter 3
Please upload a correct and readable assignment file (e.g., a text file, a PDF file, or an MS Word file).
After uploading the assignment file, you MUST validate it by checking what you uploaded. If you
uploaded a wrong file, you can take it back and upload a correct one before the assignment due date. At
the time of grading, no credit will be given to a wrong assignment (e.g., an assignment file for a different
class) or an unreadable file.
This assignment does not require the use of SQL or any database software. The results must be
manually generated. Write your answers in a text file, a PDF file, or an MS Word file, and turn in
the file.
Note: See 3.4 for explanations and examples of relational algebra operations. (For instance, see
Table 3.8.)
Answer Chapter 3 problems 8, 10, 11, 12, 15, 16, 17, 18, 19, and 20, using tables in Page 69.

Data for Assignment 1 (pp. 69, Chapter 3)


Customer
==========================================================================
CustNo
CustFirstName CustLastName CustCity CustState CustZip
CustBal
==========================================================================
C0954327 Sheri
Gordon
Littleton CO
80129-5543 $230.00
C1010398 Jim
Glussman
Denver
CO
80111-0033 $200.00
C2388597 Beth
Taylor
Seattle
WA
98103-1121 $500.00
C3340959 Betty
Wise
Seattle
WA
98178-3311 $200.00
C3499503 Bob
Mann
Monroe
WA
98013-1095
$0.00
C8543321 Ron
Thompson
Renton
WA
98666-1289 $85.00
Employee
===================================================================
EmpNo
EmpFirstName EmpLastName EmpPhone
EmpEmail
===================================================================
E1329594 Landi
Santos
(303) 789-1234 LSantos@bigco.com
E8544399 Joe
Jenkins
(303) 221-9875 JJenkins@bigco.com
E8843211 Amy
Tang
(303) 556-4321 ATang@bigco.com
E9345771 Colin
White
(303) 221-4453 CWhite@bigco.com
E9884325 Thomas
Johnson
(303) 556-9987 TJohnson@bigco.com
E9954302 Mary
Hill
(303) 556-9871 MHill@bigco.com
OrderTbl
=====================================
OrdNo
OrdDate
CustNo
EmpNo
=====================================
O1116324 01/23/2013 C0954327 E8544399
O2334661 01/14/2013 C0954327 E1329594
O3331222 01/13/2013 C1010398
O2233457 01/12/2013 C2388597 E9884325
O4714645 01/11/2013 C2388597 E1329594
O5511365 01/22/2013 C3340959 E9884325
O7989497 01/16/2013 C3499503 E9345771
O1656777 02/11/2013 C8543321
O7959898 02/19/2013 C8543321 E8544399

Notes on Aggregation Operations


Faculty Table
FacSSN FacLastName FacDept FacRank FacSalary FacSupervisor FacHireDate
098-76-5432 VINCE
MS
ASST
$35,000.00 654-32-1098
10-Apr-1997
543-21-0987 EMMANUEL MS

PROF

654-32-1098 FIBON

MS

ASSC

$70,000.00 543-21-0987

01-May-1996

765-43-2109 MACON

FIN

PROF

$65,000.00

11-Apr-1999

876-54-3210 COLAN
987-65-4321 MILLS

MS
FIN

ASST
ASSC

$40,000.00 654-32-1098
$75,000.00 765-43-2109

01-Mar-2001
15-Mar-2002

1.

$120,000.00

15-Apr-1998

Show the result of a summarize operation on the Faculty table. The grouping column is FacDept
and the aggregate calculation is COUNT. (That is, for each faculty department, count the number of
faculty members.)

Ans: First, break the table into groups (i.e., smaller tables) such that each group contains a same FacDept
value.
Group of MS Dept Faculty
FacSSN FacLastName FacDept FacRank FacSalary FacSupervisor FacHireDate
098-76-5432 VINCE
MS
ASST
$35,000.00 654-32-1098
10-Apr-1997
543-21-0987 EMMANUEL MS

PROF

654-32-1098 FIBON
876-54-3210 COLAN

ASSC
ASST

MS
MS

$120,000.00
$70,000.00 543-21-0987
$40,000.00 654-32-1098

15-Apr-1998
01-May-1996
01-Mar-2001

Group of FIN Dept Faculty


FacSSN FacLastName FacDept FacRank FacSalary FacSupervisor FacHireDate
765-43-2109 MACON

FIN

PROF

$65,000.00

11-Apr-1999

987-65-4321 MILLS

FIN

ASSC

$75,000.00 765-43-2109

15-Mar-2002

Second, count the number of rows in each group: 4 for the group of MS faculty dept faculty and 2
for the FIN dept faculty.
Thus, the answer should be:
FacDept COUNT
MS
4
FIN
2

2.

Show the result of a summarize operation on the Faculty table. The grouping column is FacDept
and the aggregate calculations are MAX and MIN. (That is, for each faculty department, find the
highest and the lowest faculty salary figures.)

Ans: First, break the table into groups (i.e., smaller tables) such that each group contains a same FacDept
value.

Group of MS Dept Faculty


FacSSN FacLastName FacDept FacRank FacSalary FacSupervisor FacHireDate
098-76-5432 VINCE
MS
ASST
$35,000.00 654-32-1098
10-Apr-1997
543-21-0987 EMMANUEL MS

PROF

654-32-1098 FIBON
876-54-3210 COLAN

ASSC
ASST

MS
MS

$120,000.00
$70,000.00 543-21-0987
$40,000.00 654-32-1098

15-Apr-1998
01-May-1996
01-Mar-2001

Group of FIN Dept Faculty


FacSSN FacLastName FacDept FacRank FacSalary FacSupervisor FacHireDate
765-43-2109 MACON

FIN

PROF

$65,000.00

11-Apr-1999

987-65-4321 MILLS

FIN

ASSC

$75,000.00 765-43-2109

15-Mar-2002

Second, find the maximal and minimal FacSalary values in each group: $120,000 and $35,000 for
the MS dept faculty group; $75,000 and $65,000 for the FIN dept faculty group.
Thus, the answer should be:
FacDept MAX
MIN
MS
$120,000 $35,000
FIN
$75,000 $65,000

3.

Show the result of a summarize operation on the Faculty table. The grouping column is FacDept
and the aggregate calculation is AVG. (That is, for each faculty department, calculate the average
salary figure.)

Ans: First, break the table into groups (i.e., smaller tables) such that each group contains a same FacDept
value.
Group of MS Dept Faculty
FacSSN FacLastName FacDept FacRank FacSalary FacSupervisor FacHireDate
098-76-5432 VINCE
MS
ASST
$35,000.00 654-32-1098
10-Apr-1997
543-21-0987 EMMANUEL MS

PROF

654-32-1098 FIBON
876-54-3210 COLAN

ASSC
ASST

MS
MS

$120,000.00
$70,000.00 543-21-0987
$40,000.00 654-32-1098

15-Apr-1998
01-May-1996
01-Mar-2001

Group of FIN Dept Faculty


FacSSN FacLastName FacDept FacRank FacSalary FacSupervisor FacHireDate
765-43-2109 MACON

FIN

PROF

$65,000.00

11-Apr-1999

987-65-4321 MILLS

FIN

ASSC

$75,000.00 765-43-2109

15-Mar-2002

Second, calculate the average FacSalary value in each group: $66,250 for the group of MS faculty
dept faculty and $70,000 for the FIN dept faculty.
Thus, the answer should be:
FacDept AVERAGE
MS
$66,250
FIN
$70,000

4.

Show the result of a summarize operation on the Faculty table. The grouping column is FacDept
and the aggregate calculation is SUM. (That is, for each faculty department, calculate the total
salary figure.)

Ans: First break the table into groups (i.e., smaller tables) such that each group contains a same FacDept
value.
Group of MS Dept Faculty
FacSSN FacLastName FacDept FacRank FacSalary FacSupervisor FacHireDate
098-76-5432 VINCE
MS
ASST
$35,000.00 654-32-1098
10-Apr-1997
543-21-0987 EMMANUEL MS

PROF

654-32-1098 FIBON
876-54-3210 COLAN

ASSC
ASST

MS
MS

$120,000.00
$70,000.00 543-21-0987
$40,000.00 654-32-1098

15-Apr-1998
01-May-1996
01-Mar-2001

Group of FIN Dept Faculty


FacSSN FacLastName FacDept FacRank FacSalary FacSupervisor FacHireDate
765-43-2109 MACON

FIN

PROF

$65,000.00

11-Apr-1999

987-65-4321 MILLS

FIN

ASSC

$75,000.00 765-43-2109

15-Mar-2002

Second, add up the FacSalary values in each group: $265,000 for the group of MS faculty dept
faculty and $140,000 for the FIN dept faculty.
Thus, the answer should be:
FacDept SUM
MS
$265,000
FIN
$140,000

Potrebbero piacerti anche