Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following tables with sample data form some part of a database held in a relational DBMS: Product ( productNo , productName, price, quantity, supplierNo):

The following tables with sample data form some part of a database held in a relational DBMS:

Product (productNo, productName, price, quantity, supplierNo): productNo is a primary key.

productNo

productName

price

quantity

supplierNo

p1

A4 paper

$40

50

s1

p2

B1 paper

$45

40

s2

p3

Legal Paper

$100

50

s2

Supplier (supplierNo, SupplierName, Address, Contact): supplierNo is a primary key.

supplierNo

SupplierName

Address

Contact

s1

BMCC

199 Chamber St, NYC, NY

Don Wei

s2

Hunter

695 Park Ave

New York, NY 10065

Jochen Albret

s3

City Tech

300 Jay St, Brooklyn, NY 11201

Hong Li

Order (orderNo, orderDate, paymentMethod): orderNo is a primary key.

orderNo

orderDate

paymentMethod

Customer

o1

1/1/2015

Cash

Tina Smith

o2

1/2/2015

Cash

Eric Nicholas

o3

3/3/2015

Credit

Mary Davis

Purchase (orderNo, productNo, quantity): (orderNo,productNo) is a primary key.

orderNo

productNo

quantity

o1

p1

5

o1

p2

4

o2

p1

10

Identify and describe all the foreign keys for the above relations. (12pts)

Note:

Foreign Key: Attribute, or set of attributes, within one relation that matches candidate key (or primary key) of some (possibly same) table.

There are three foreign keys.

You should describe the foreign key in the format of The foreign key attributeName in a table name references to the attributeName in a table name."

If one tries to insert a new row into Order table with ('o3', '1/1/2015', 'Cash', Tina Smith). Does this insertion operation cause any violation of any integrity rule? Why? (5 pts)

If one tries to insert a new row into Purchase table with ('o5', 'p2', 5). Does this insertion operation cause any violation of any integrity rule? Why? (5 pts)

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

Relational Database And Transact SQL

Authors: Lucy Scott

1st Edition

1974679985, 978-1974679980

More Books

Students also viewed these Databases questions