Assignment Number 1 -Answers

7
Assignment Number 1 The problems use the Customer, OrderTbl, and Employee tables of the simplified Order Entry database. Chapters 4 and 10 extend the database to increase its usefulness. The Customer table contains clients who have placed orders. The OrderTbl contains basic facts about customer orders. The Employee table contains facts about employees who take orders. The primary keys of the tables are CustNo for Customer, EmpNo for Employee, and OrdNo for OrderTbl. Customer CustNo CustFirst Name CustLast Name CustC ity CustS tate CustZ ip CustB al C09543 27 Sheri Gordon Littl eton CO 80129 -5543 230 C10103 98 Jim Glussman Denve r CO 80111 -0033 200 C23885 97 Beth Taylor Seatt le WA 98103 -1121 500 C33409 59 Betty Wise Seatt le WA 98178 -3311 200 C34995 03 Bob Mann Monro e WA 98013 -1095 0 C85433 21 Ron Thompson Rento n WA 98666 -1289 85 Employee EmpNo EmpFirst Name EmpLastN ame EmpPhon e EmpEmail E1329 594 Landi Santos (303) 789- 1234 LSantos@bigco .com E8544 399 Joe Jenkins (303) 221- 9875 JJenkins@bigc o.com E8843 211 Amy Tang (303) 556- 4321 [email protected] om E9345 771 Colin White (303) 221- 4453 CWhite@bigco. com E9884 Thomas Johnson (303) TJohnson@bigc

description

assignment 1 in UT Dallas Data Management online course

Transcript of Assignment Number 1 -Answers

Page 1: Assignment Number 1 -Answers

Assignment Number 1The problems use the Customer, OrderTbl, and Employee tables of the simplified Order Entry database. Chapters 4and 10 extend the database to increase its usefulness. The Customer table contains clients who have placed orders.The OrderTbl contains basic facts about customer orders. The Employee table contains facts about employees whotake orders. The primary keys of the tables are CustNo for Customer, EmpNo for Employee, and OrdNo for OrderTbl.

Customer

CustNoCustFirstName

CustLastName

CustCity

CustState CustZip

CustBal

C0954327 Sheri Gordon

Littleton CO

80129-5543 230

C1010398 Jim Glussman Denver CO

80111-0033 200

C2388597 Beth Taylor Seattle WA

98103-1121 500

C3340959 Betty Wise Seattle WA

98178-3311 200

C3499503 Bob Mann

Monroe WA

98013-1095 0

C8543321 Ron Thompson Renton WA

98666-1289 85

Employee

EmpNoEmpFirstName

EmpLastName EmpPhone EmpEmail

E1329594 Landi Santos

(303) 789-1234

[email protected]

E8544399 Joe Jenkins

(303) 221-9875

[email protected]

E8843211 Amy Tang

(303) 556-4321 [email protected]

E9345771 Colin White

(303) 221-4453

[email protected]

E9884325 Thomas Johnson

(303) 556-9987

[email protected]

E9954302 Mary Hill

(303) 556-9871 [email protected]

Orders

OrdNoOrdDate CustNo EmpNo

O1116324

1/23/13

C0954327

E8544399

O2334661

1/14/13

C0954327

E1329594

O3331222

1/13/13

C1010398

O22334 1/12/1 C23885 E98843

Page 2: Assignment Number 1 -Answers

57 3 97 25O4714645

1/11/13

C2388597

E1329594

O5511365

1/22/13

C3340959

E9884325

O7989497

1/16/13

C3499503

E9345771

O1656777

2/11/13

C8543321

O7959898

2/19/13

C8543321

E8544399

Question 8: Show the result of a restrict operation that lists the orders in February 2013.Ans:

OrdNo OrdDate CustNo EmpNoO1656777

02/11/2013 C8543321

O7959898

02/19/2013 C8543321 E8544399

Question 9: Show the result of a restrict operation that lists the customers residing in Seattle, WA.Ans:

CustNo CustFirstName

CustLastName CustCity CustState

CustZip CustBal

C2388597 Beth Taylor Seattle WA 98103-1121 $500.00C3340959 Betty Wise Seattle WA 98178-3311 $200.00

Question 11: Show the result of a project operation that lists the CustCity and CustState columns of the Customer table.Ans:

CustCity CustStateLittleton CODenver COSeattle WASeattle WAMonroe WARenton WA

Question 14: Show the result of a natural join of the Employee and OrderTbl tables.Ans:

EmpNo

EmpFirstName

EmpLastName

EmpPhone

EmpEmail OrdNo OrdDate

CustNo EmpNo

E8544399

Joe Jenkins (303) 221-9875

[email protected]

O1116324

01/23/13

C0954327

E8544399

E1329594

Landi Santos (303) 789-

[email protected]

O2334661

01/14/13

C0954327

E1329594

Page 3: Assignment Number 1 -Answers

1234E9884325

Thomas Johnson (303) 556-9987

[email protected]

O2233457

01/12/13

C2388597

E9884325

E1329594

Landi Santos (303) 789-1234

[email protected]

O4714645

01/11/13

C2388597

E1329594

E9884325

Thomas Johnson (303) 556-9987

[email protected]

O5511365

01/22/13

C3340959

E9884325

E9345771

Colin White (303) 221-4453

[email protected]

O7989497

01/16/13

C3499503

E9345771

E8544399

Joe Jenkins (303) 221-9875

[email protected]

O7959898

02/19/13

C8543321

E8544399

Question 15:Show the result of a one-sided outer join between the Employee and OrderTbl tables. Preserve the rows of the OrderTbl table in the resultAns:

OrdNo OrdDate

CustNo

EmpNo

EmpNo

EmpFirstName

EmpLastName

EmpPhone

EmpEmail

O1116324

01/23/13

C0954327

E8544399

E8544399

Joe Jenkins (303) 221-9875

[email protected]

O2334661

01/14/13

C0954327

E1329594

E1329594

Landi Santos (303) 789-1234

[email protected]

O3331222

01/13/13

C1010398

O2233457

01/12/13

C2388597

E9884325

E9884325

Thomas Johnson (303) 556-9987

[email protected]

O4714645

01/11/13

C2388597

E1329594

E1329594

Landi Santos (303) 789-1234

[email protected]

O5511365

01/22/13

C3340959

E9884325

E9884325

Thomas Johnson (303) 556-9987

[email protected]

O7989497

01/16/13

C3499503

E9345771

E9345771

Colin White (303) 221-4453

[email protected]

O1656777

02/11/13

C8543321

O7959898

02/19/13

C8543321

E8544399

E8544399

Joe Jenkins (303) 221-9875

[email protected]

Page 4: Assignment Number 1 -Answers

Question 16: Show the result of a full outer join between the Employee and OrderTbl tables. Ans:

OrdNo OrdDate

CustNo

EmpNo

EmpNo

EmpFirstName

EmpLastName

EmpPhone

EmpEmail

O1116324

01/23/13

C0954327

E8544399

E8544399

Joe Jenkins (303) 221-9875

[email protected]

O2334661

01/14/13

C0954327

E1329594

E1329594

Landi Santos (303) 789-1234

[email protected]

O3331222

01/13/13

C1010398

O2233457

01/12/13

C2388597

E9884325

E9884325

Thomas Johnson (303) 556-9987

[email protected]

O4714645

01/11/13

C2388597

E1329594

E1329594

Landi Santos (303) 789-1234

[email protected]

O5511365

01/22/13

C3340959

E9884325

E9884325

Thomas Johnson (303) 556-9987

[email protected]

O7989497

01/16/13

C3499503

E9345771

E9345771

Colin White (303) 221-4453

[email protected]

O1656777

02/11/13

C8543321

O7959898

02/19/13

C8543321

E8544399

E8544399

Joe Jenkins (303) 221-9875

[email protected]

E8843211

Amy Tang (303) 556-4321

[email protected]

E9954302

Mary Hill (303) 556-9871

[email protected]

Q17: Show the result of the restrict operation on Customer where the condition is CustCity equals “Denver” or “Seattle”followed by a project operation to retain the CustNo, CustFirstName, CustLastName, and CustCity columns.Ans:

CustNoCustFirstName

CustLastName

CustCity

C1010398 Jim Glussman DenverC2388597 Beth Taylor Seattle

Page 5: Assignment Number 1 -Answers

C3340959 Betty Wise Seattle

Q18:Show the result of a natural join that combines the Customer and OrderTbl tables followed by a restrict operationto retain only the Colorado customers (CustState = “CO”).Ans:

CustNo

CustFirstName

CustLastName

CustCity

CustState

CustZip

CustBal

OrdNo OrdDate

EmpNo

C0954327

Sheri Gordon Littleton

CO 80129-5543

230$ O1116324

01/23/13

E8544399

C0954327

Sheri Gordon Littleton

CO 80129-5543

230$ O2334661

01/14/13

E1329594

C1010398

Jim Glussman Denver

CO 80111-0033

200$ O3331222

01/13/13

Q19:Show the result of a summarize operation on Customer. The grouping column is CustState and the aggregatecalculation is COUNT. COUNT shows the number of rows with the same value for the grouping column.

Ans:

NUMBER

CustState

2 CO4 WA

Q20:Show the result of a summarize operation on Customer. The grouping column is CustState and the aggregatecalculations are the minimum and maximum CustBal valuesAns:

MIN BALANCE

MAX BALANCE

CustState

200$ 230$ CO0$ 500$ WA