Homework #2

# Homework #2 - IST210 Name Login Section Homework 2 Due...

This preview shows pages 1–3. Sign up to view the full content.

IST210 Name: Login: Section # Homework 2 Due : Sunday 3/4/2007 by midnight. Submit to ANGEL Problem 1. Suppose that the E-R diagram below represents the conceptual design of a database application of a bookstore. Convert the E-R diagram into relational schema and use the CREATE TABLE statements to show your results. Make sure to name each table properly and define any primary key constraints and foreign key constraints. Use proper domain for each attribute. -Customers will be defined by customer ID, name and phone number -primary key is customer ID -Books will be defined by ISBN, Title and price -primary key is ISBN -Customers can order as many books as they want -Addresses are defined by code, street, ZIP and city -primary key is code -if customers decide to pick up the books themselves, the address information can be deleted -All orders are shipped to one address -Payments will be defined by amount and number of payments -primary key is Pnum -each customer makes one mandatory payment Page 1 of 5 Customers Books Addresses Order Ship_To M N 1 M Code Title price ZIP ISBN Cust_ID name phone Make 1 Payments M amount Pnum City Street

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
IST210 Name: Login: Section # CREATE TABLE hw2_Customers ( Cust_ID char(10), name char(20), phone char(10), PRIMARY KEY (Cust_ID) ) CREATE TABLE hw2_Books ( isbn char(20), title char(40), price money, customers_order char(10), PRIMARY KEY (isbn), FOREIGN KEY (customers_order) REFERENCES hw2_customers (Cust_ID) ) CREATE TABLE hw2_Payments ( amount money, Pnum char(10), customers_make char(10), PRIMARY KEY (Pnum), FOREIGN KEY (customers_make) REFERENCES hw2_customers (Cust_ID)
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 05/04/2008 for the course IST 210 taught by Professor Mcconn,charlotteryoo,jungwoo during the Spring '08 term at Penn State.

### Page1 / 5

Homework #2 - IST210 Name Login Section Homework 2 Due...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online