Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CSC - Database The following database is given: BUYER Name Age Gender Alice 20 Female Bob 21 Male Carol 18 Female CARD CardNum Owner Limit

CSC - Database The following database is given:

BUYER

Name

Age

Gender

Alice

20

Female

Bob

21

Male

Carol

18

Female

CARD

CardNum

Owner

Limit

1111

Alice

50

1234

Bob

10

4321

Bob

30

9999

Carol

1000

PRODUCT

PName

Type

Price

Weight

Pen

Office

3

5

Pencil

Office

2

3

Notebook

Office

10

400

Camera

Electronic

300

600

Bike

Transport

100

15000

Skateboard

Transport

50

1500

Pan

Kitchen

25

700

ORDER

Buyer

Product

Count

Alice

Pen

4

Alice

Notebook

2

Bob

Bike

1

Alice

Pan

1

Carol

Camera

1

Carol

Skateboard

1

Note:

Underline indicates Primary Key

Foreign Key (Buyer) in ORDER references BUYER (Name)

Foreign Key (Product in ORDER references PRODUCT (PName)

Foreign Key (Owner) in CARD references BUYER (Name)

Buyers can own one or more cards. Buyers can order one or more products.

In each of the following problems a Relational Algebra expression given.

You are asked to hand-compute the expression and type-in (or write-in) the result set below the expression.

6. Intersection Example

(PROJECT (PRODUCT.PName, ORDER.Buyer)

(SELECT (PRODUCT.Price <= 10)

(JOIN (PRODUCT.PName = ORDER.Product) PRODUCT, ORDER)))

(PROJECT (PRODUCT.PName, ORDER.Buyer)

(SELECT (ORDER.Count <= 2)

(JOIN (PRODUCT.PName = ORDER.Product) PRODUCT, ORDER)))

(4 pts)

Do it step by step

A= (JOIN (PRODUCT.PName = ORDER.Product) PRODUCT, ORDER)

B = (SELECT (PRODUCT.Price <= 10) A)

C = (PROJECT (PRODUCT.PName, ORDER.Buyer) B)

D = (SELECT (ORDER.Count <= 2) A)

E = (PROJECT (PRODUCT.PName, ORDER.Buyer) D)

Final Answer C INTERSECTION E

7. Set Difference Example

(PROJECT (PName) (SELECT (Weight >= 500) PRODUCT))

(PROJECT (Product) (SELECT (Buyer = 'Carol' OR Buyer = 'Alice') ORDER) (3 pts)

DO it step by step:

A = (PROJECT (PName) (SELECT (Weight >= 500) PRODUCT))

B= (PROJECT (Product) (SELECT (Buyer = 'Bob' OR Buyer = 'Alice') ORDER)

A B

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Third International Conference Achids 2011 Daegu Korea April 2011 Proceedings Part 2 Lnai 6592

Authors: Ngoc Thanh Nguyen ,Chong-Gun Kim ,Adam Janiak

2011th Edition

3642200419, 978-3642200410

More Books

Students also viewed these Databases questions

Question

Under what circumstances must an F# selector have an else clause?

Answered: 1 week ago

Question

The models used to analyse different national cultures.

Answered: 1 week ago

Question

The nature of the issues associated with expatriate employment.

Answered: 1 week ago