Вы находитесь на странице: 1из 6

1.

Fragment the Customer table so that customers of rep 20 form a fragment named
CustomerRep20, customers of rep 35 form a fragment named CustomerRep35, and
customers of rep 65 form a fragment named CustomerRep65. (Include all fields from the
Customer table in each fragment.) In addition, you need to fragment the Orders table so
that orders are distributed and stored with the customers that placed the orders. For
example, fragment OrdersRep20 consists of those orders placed by customers of rep 20.
Write the SQL-type statements to create these fragments.
Customer
Table:
Customer(CustomerNum, CustomerName, Street, City, State, Zip, Balance, CreditLimit,
RepNum)
Fragment Part 1
SQL Statement
Select * from customer where RepNum=20;
CustomerNu

CustomerNam

148

Street

S1

City

State

FL

Zip

3333

Balanc

CreditLimi

RepNu

$51620

$100000

20

$56320

$75000

20

$52320

$60000

20

6
524

S6

FL

3333
6

842

S10

FL

3332
1

Fragment part 2
SQL Statement
Select * from customer where RepNum=35;
CustomerNu

CustomerNam

282

Street

S2

City

State

FL

Zip

3332

Balanc

CreditLimi

RepNu

$55520

$70000

35

$13520

$20000

35

$58320

$65000

35

$55320

$75000

35

Balanc

CreditLimi

RepNu

$76820

$35000

65

$78320

$85000

65

$23320

$30000

65

1
408

S4

FL

3350
3

687

S8

FL

3354
3

725

S9

FL

3355
3

Fragment part 3
SQL Statement
Select * from customer where RepNum=65;
CustomerNu

CustomerNam

356

Street

S3

City

State

FL

Zip

3314
6

462

S5

FL

3332
1

608

S7

FL

3355

Orders Table:
Orders (OrderNum, OrderDate, CustomerNum)
Fragment part 1
SQL Statement
Select * from orders where CustomerNum=148;
OrderNum

OrderDate

CustomerNum

O1

8/20/2013

148

O6

8/23/2013

148

Fragment part 2
SQL Statement
Select * from orders where CustomerNum=408;

OrderNum

OrderDate

CustomerNum

O3

8/21/2013

408

O4

8/21/2013

282

Fragment part 3

SQL Statement
Select * from orders where CustomerNum=408;
OrderNum

OrderDate

CustomerNum

O3

8/21/2013

408

2. Create a class diagram for the Premiere Products database, as shown in Chapter 1, Figure
1-5. If you need to make any assumptions in preparing the diagram, document those
assumptions.
Class Diagram:

2. A user queries the Part table in the Premiere Products database over the company
intranet. Assume the Part table contains 5,000 rows, each row is 1,000 bits long, the
access delay is 2.5 seconds, the transmission rate is 50,000 bits per second, and only 20
of the 5,000 rows in the Part table satisfy the query conditions. Calculate the total
communication time required for this query based on retrieving all table rows one row at
a time, then calculate the total communication time required based on retrieving the 20
rows that satisfy the query conditions in a single message.
Given:
Total rows=5,000
Length of each row=1,000 bits
Access Decay= 2.5 sec
Transmission rate=50,000 bits per sec
The total communication time required for this query based on retrieving all table
rows one row at a time.
Solution:
Formula: [access decay+{(total rows*length of each row)/transmission rate}]

For 1 row at a time total row=1


2.5+{(1*1,000)/50,000}
`

2.52 seconds

Total communication time for retrieving all table rows:

2.52*5,000
12,600 seconds
The total communication time required based on retrieving the 20 rows that satisfy
the query conditions in a single message.
Solution:
2.5+{(20*1000)/50,000}
2.9 seconds

Вам также может понравиться