what is the premiere products jkpgw system for school work for database management

28
JKPGW System for Premiere Products Company Table of contents 1) System Summary (Introduction) 2) What is the Premiere Products JKPGW System? 3) System requirement for the Project 4) Database Design Requirement 5) System Objectives 6) System Model 7) Privacy Statement 8) Support 9) Payment methods 10) Tables 11) Region 12) Data Catalogs 13) Detail Explanation 14) Relational Schema Diagram 15) Functional dependency 16) SQL statement

Upload: win

Post on 15-Nov-2014

110 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: What is the Premiere Products JKPGW System for School Work for Database Management

JKPGW System for Premiere Products Company

Table of contents

1) System Summary (Introduction)

2) What is the Premiere Products JKPGW System?3) System requirement for the Project

4) Database Design Requirement5) System Objectives

6) System Model7) Privacy Statement

8) Support

9) Payment methods

10) Tables11) Region

12) Data Catalogs13) Detail Explanation

14) Relational Schema Diagram

15) Functional dependency

16) SQL statement

Page 2: What is the Premiere Products JKPGW System for School Work for Database Management

JKPGW System for Premiere Products Company

1) System Summary

Introduction

Premiere Products Company produces the distributor of appliances, house wares, and sporting goods.

The customers can access and view to the company's on-line catalogue through a normal Net Browser. All information is stored in the company database workstation. The company is using Microsoft Access and MySQL software to store the databases.

Currently, the database of the company is increasing the size of database in order to maintain the high number of orders each day, so that the company needs to design very useful and easily to use database system to support their business.

Finally, the company’s management department needs to decide to design database by using Microsoft Access and MySQL for their daily business to store the information of the customer and products out and in.

2) What is the Premiere Products JKPGW System?

The JKPGW system of the premiere products is to create, add, remove, and update the data by using Microsoft Access and MySQL with the table which allows the manager easily to determine the company’s products amount that contains table of customer, rep, order, order line and part.

On the other hand, our system is designed for the staffs will be able to obtain answers to their questions concerning the data in the database easily and quickly with the option of the producing a variety of useful reports.

3) System requirement for the Project

We are going to use the system in our premiere product company is JKPW system which can store the data create, update, delete and it is very quick to get

Page 3: What is the Premiere Products JKPGW System for School Work for Database Management

the information from our system which is very easily to create and manage weekly the information.

4) Database Design Requirement

In our Premiere Products project, we are going to put and require in the following information which much support and easy to use for the users.

1. For the sale rep table, we will store the sales rep’s number, last name, first name, street address, city, state, zip code, total commission, and commission rate.

2. For a customer, store the customer’s number, name, street address, city, state, zip code, balance, and credit limit. In addition, store the number, last name, and first name of the sales rep that represents this customer. The analyst has also determined that a sale rep can represent many customers, but a customer must have exactly one sales rep (in other words, a sales rep must represent a customer; a customer cannot be represented by zero or more than one sales reps) because we also want to give bonus to our rep who can sell the company goods’ more than some amount of money.

3. For apart, store the part’s number, description, units on hand, item class, the number of the warehouse in which the part is located, and the price. All units of a particular part are stored in the same warehouse.

4. For an order, store the order number, order date, the number and name of the customer that placed the order and the number of the sales rep who represents that customer.

5. For each line item within an order, store the part number and description, the number ordered, and the quoted price. The analyst also obtained the following information concerning orders:a. There is only one customer per order.b. On a given order, there is at most one line item for a given part. For

example, part DR93 cannot appear on several lines within the same order.

c. The quoted price might differ from the actual price, in cases in which the sales rep offered a discount for a certain part on a specific order.

6. For Discount, store7. For Bonus, store

Page 4: What is the Premiere Products JKPGW System for School Work for Database Management

5) System Objectives

1. To provide the company with the new database design in order to make

sure for the data manipulating and retrieval.

2. To use the database program with the 'Microsoft Access’ and MySQL for

the input and output information which required with a complete user-

friendly interface.

3. To design and produce with the easiest way to use and error free database

in a feasible amount of time.

6) System Model

This section, we are going to design with the entity relationship between one

table to the other table, how is connected and we also provide with the data

dictionary which subsection will contain detailed explanations for each entity,

region of each data field, and the data catalogue.

7) Privacy Statement

The premiere products company guarantees for the customer's privacy

and never give, distribute, sell or rent customer’s personal information to the

others. The premiere products company may not share customer information for

marketing partners or for research purposes.

8) Support

Premiere Products Customer Service staffs always try to make sure that the

customer's experience in purchasing goods and welcomes the customers’

questions, concerns or suggestions and servicing within 24 hours or as soon as

possible.

Page 5: What is the Premiere Products JKPGW System for School Work for Database Management

9) Payment Methods

The company accepts the following payment methods with credit cards,

cheques and cash especially US dollar.

For the Credit Cards

Customer can buy the company’s product with Visa, MasterCard, and American

Express and also can give customer’s credit card detail by using phone, fax or

other online network. The company never receives the customer card before the

order is ready to transport.

10) Tables

REP_NUM LAST_NAME FIRST_ NAME

STREET CITY STATE ZIP COMMISSION

RATE

20 Kaiser Valerie 624 Randall

Grove FL 33321 $20,542.50 0.05

35 Hill Richard 532 Jackson

Sheldon FL 33553 $39,216.00 0.07

65 Perez Juan 1626 Taylor

Fillmore FL 33336 $23,487.00 0.05

75 Son Jiho 100 korea

Seoul FL 25367 $10,000.00 0.08

85 Win Lose 156 rangsit

Pathumtani FL 24656 $5,000.00 0.04

CUSTOMER_NUM

CUSTOMER_NAME

STREET CITY STATE

ZIP BALANCE

CREDIT_LIMIT

REP_NUM

148 Al’s Appliance and sport

2837 Greenway

Fillmore

FL 33363

$6,550.00

$7,500.00 20

282 Brookings Direct

3827 Devon

Grove FL 33321

$431.50 $10,000.00

35

356 Ferguson’s 382 Wildwood

Northfield

FL 33146

$5,785.00

$7,500.00 65

408 The Everything shop

1828 Raven

Crystal FL 3350

$5,285.00

$5,000.00 35

462 Bargains Galore

3829 Central

Grove FL 33321

$3412.00

$10,000.00

65

524 Kline’s 838 Ridgela

Fillmore

FL 33336

$12,762.00

$15,000.00

20

Page 6: What is the Premiere Products JKPGW System for School Work for Database Management

nd608 Johnson’s

Department Store

372 Oxford

Sheldon

FL 35553

$2,106.00

$10,000.00

65

687 Lee’s Sport and Appliance

282 Evergreen

Altomville

FL 32543

$2,851.00

$5,000.00 35

725 Deerfield’s Four Seasons

282 Columbia

Sheldon

FL 33553

$248.00 $7,500.00 35

842 All Seasons 28 Lakeview

Grove FL 33333

$8,221.00

$7,500.00 35

ORDER_NUM ORDER_DATE CUSTOMER_NUM21608 10/20/2007 14821610 10/20/2007 35621613 10/21/2007 40821614 10/21/2007 28221617 10/23/2007 60821619 10/23/2007 14821623 10/23/2007 608

ORDER_NUM PART_NUM NUM_ORDERED QUOTED_PRICE21608 AT94 11 $21.9521610 DR93 1 $495.0021610 DW11 1 $399.9921613 KL62 1 $329.9521614 KT03 2 $595.0021617 BV06 2 $194.9521617 CD52 4 $150.0021619 DR93 1 $495.0021623 KV29 2 $1,290.00

PART_NUM DESCRIPTION ON_HAND CLASS WAREHOUSE PRICEAT94 Iron 50 HW 3 $24.95BV06 Home Gym 45 SG 2 $794.95CD52 Microwave

Oven32 AP 1 $165.00

DL71 Cordless Drill 21 HW 3 $129.95DR93 Gas Range 8 AP 2 $495.00DW11 Washer 12 AP 3 $399.99FD21 Stand Mixer 22 HW 3 $159.95KL62 Dryer 12 AP 1 $349.95KT03 Dishwasher 8 AP 3 $595.00

Page 7: What is the Premiere Products JKPGW System for School Work for Database Management

KV29 Treadmill 9 SG 2 $1,390.00

11) Region

Definition of the data types used is as follows:

Syntax Description

STR2 A fixed character string of length 2 characters

STR11 A fixed character string of length 11 characters

VSTR25 and 15 A variable character string of maximum length 25 and 15 characters

INTEGER A whole number

DATE Of the form DD/MM/YY

Decimal A decimal number used to describe (2,3 and 7,2)

$ A rational number used to describe monetary value

12) Data Catalogue

Relation Attribute Type In

PK

?

In

FK

?

FK relation Can

be

Null

Choice for List

Types

REP Rep-

Num

INTEGE

R

Y N CUSTOMER N -

REP Last-

name

STR11 N N N -

REP First-

name

STR11 N N N -

Page 8: What is the Premiere Products JKPGW System for School Work for Database Management

REP Street STR15 N N Y -

REP City STR15 N N Y -

REP State STR2 N N Y

REP Zip INTEGE

R

N N N -

REP Commiss

-ion

$ N N N

REP Rate Decimal N N N -

CUSTOME

R

Custome

r-num

INTEGE

R

Y N ORDERS N -

CUSTOME

R

Custome

r-name

STR25 N N N -

CUSTOME

R

Street VSTR15 N N Y -

CUSTOME

R

City STR15 N N Y -

CUSTOME

R

State STR2 N N Y -

CUSTOME

R

Zip INTEGE

R

N N Y

CUSTOME

R

Balance $ N N N -

CUSTOME

R

Credit-

limit

$ N N N -

CUSTOME

R

Rep-

Num

INTEGE

R

N Y N -

ORDER Order- INTEGE Y N ORDER- N -

Page 9: What is the Premiere Products JKPGW System for School Work for Database Management

Num R LINE

ORDER Order-

Date

DATE N N Y -

ORDER Custome

r-Num

INTEGE

R

N Y N -

ORDER-

LINE

Order-

Num

INTEGE

R

Y Y N -

Page 10: What is the Premiere Products JKPGW System for School Work for Database Management

ORDER-

LINE

Part-num STR11 Y Y N -

ORDER-

LINE

Num-

Ordered

INTEGE

R

Y N N -

ORDER-

LINE

Quoted-

price

$ N N N -

PART Part-

Num

STR11 Y N ORDERED-

LINE

N -

PART Descripti

on

STR11 N N N -

PART On-Hand INTEGE

R

N N N -

PART Class STR2 N N N -

PART Warehou

se

INTEGE

R

Y N N -

PART Price $ N N N -

13) Detail Explanation

REP

Rep-Num This is Rep-Num represents Primary Key for REP table

Last-Name The last name of representation sell person for the company

First-Name The first name of representation sell person for the company

Street This is the name of the street where rep lives.

City This is the name of the city where the rep lives.

State This is the name of the state where the rep lives.

Zip This is the zip code for post office.

Page 11: What is the Premiere Products JKPGW System for School Work for Database Management

Commission The amount of money that the rep sell for the company

Rate The amount of percentage that rep get from the company

CUSTOMER

Customer-Num The number of the customer who buy the goods from the company

and it represents for the Primary key for the Customer Table

Name The name of the customer.

Street This is the name of the street where the customer lives.

City This is the name of the city where the customer lives.

State This is the name of the state where the customer lives.

Zip This is the zip code for post office.

Balance This is the amount of money which the customer has.

Credit-Limit This is the amount of money which the customer can buy the

products.

Rep-Num The number of rep which represents for the foreign key.

ORDERS

Order-Num The number of order which customer order for their supplied.

Order-Date This is the date for the goods ordered.

Customer-Num The number of customer which represents for foreign key.

Page 12: What is the Premiere Products JKPGW System for School Work for Database Management

ORDER-LINE

Order-Num The number of order which customer order for their supplied. It

represents candidate key.

Part-Num The number of part which represents candidate key.

Num-Ordered This is the number of the ordered goods from the company. It

represents Primary key.

Quoted-Price This is the price of the goods which orders by the customers.

PART

Part-Num The number of part which represents Primary key.

Description The name of the products which the company produces.

On-Hand The number of the products.

Warehouse The number of the warehouse where we place the products.

Price The price of the goods.

14) Relational Schema Diagram

15) Functional Dependencies

The following are functional dependencies for each relation.

REP

Rep-Num Last name, First name, Street, City, State, Zip, Commission, Rate

Assumption:

There is only one last name, first name, state, city, zip, commission and rate for each rep-

num.

Page 13: What is the Premiere Products JKPGW System for School Work for Database Management

CUSTOMER

Customer-Num Customer name, Street, City, State, Zip, Balance, Credit-Limit and

Rep-Num.

Assumption:

The customer number determines every information and detail in the customer table.

ORDERS

Order-Num order date and customer-number.

Assumption:

Order number determines the date of the order and the customer number.

ORDER-LINE

Order-Num, Part-Num num-ordered and quoted price.

Assumption:

The candidate key orders number and part number determines num ordered and quoted

price.

PART

Part number Description, On-Hand, Class, Warehouse and Price.

Assumption:

Part number determine, description, On-Hand, Class, Warehouse and Price.

Multi-valued Dependencies

The following are multi-valued dependencies for each relation.

REP

State City, Street and zip.

Rep-Num last name and first name.

Assumption:

Each state will have different city name and street name.

CUSTOMER

Page 14: What is the Premiere Products JKPGW System for School Work for Database Management

Customer-Num Customer name, balance, credit limit and rep-num.

State city, street and zip.

Assumption:

The customer number is the primary key for this table so that if we have customer number

we can get the name of customer and others detail which related to customer.

ORDERS

Order number order date and customer number.

Assumption:

Each order has a number which can find the date of the order and the customer number

who ordered the goods.

ORDER-LINE

Order number part number, num-ordered and quoted price.

Part number order number, num-ordered and quoted price.

Assumption:

Both order number and part number are dependent on each other.

Distinct queries and Output

15) SQL statement

These codes are going to show, how we create our table and how we are going to insert

our data in our database.

CREATE DATABASE PREMIERE;

USE PREMIERE;

CREATE TABLE REP

(REP_NUM CHAR(2) PRIMARY KEY,LAST_NAME CHAR(15),FIRST_NAME CHAR(15),STRET

CHAR(15),CITY CHAR(15),STATE CHAR(2),ZIP CHAR(5),COMMISSION DECIMAL(7,2),RATE

DECIMAL(3,2) );

Page 15: What is the Premiere Products JKPGW System for School Work for Database Management

CREATE TABLE CUSTOMER

(CUSTOMER_NUM CHAR(3) PRIMARY KEY,CUSTOMER_NAME CHAR(35) NOT NULL,STREET

CHAR(15),CITY CHAR(15),STATE CHAR(2),ZIP CHAR(5),BALANCE DECIMAL(8,2),CREDIT_LIMIT

DECIMAL(8,2),REP_NUM CHAR(2) );

CREATE TABLE ORDERS

(ORDER_NUM CHAR(5) PRIMARY KEY,ORDER_DATE DATE,CUSTOMER_NUM CHAR(3) );

CREATE TABLE PART(PART_NUM CHAR(4) PRIMARY KEY,DESCRIPTION CHAR(15),

ON_HAND DECIMAL(4,0),CLASS CHAR(2),WAREHOUSE CHAR(1),PRICE DECIMAL(6,2) );

CREATE TABLE ORDER_LINE

(ORDER_NUM CHAR(5),PART_NUM CHAR(4),NUM_ORDERED DECIMAL(3,0),QUOTED_PRICE

DECIMAL(6,2),PRIMARY KEY (ORDER_NUM, PART_NUM) );

This code will show, how we are going to insert our data into the database.

INSERT INTO REP

VALUES

('20','Kaiser','Valerie','624 Randall','Grove','FL','33321',20542.50,0.05);

INSERT INTO REP

VALUES

('35','Hull','Richard','532 Jackson','Sheldon','FL','33553',39216.00,0.07);

INSERT INTO REP

VALUES

('65','Perez','Juan','1626 Taylor','Fillmore','FL','33336',23487.00,0.05);

Page 16: What is the Premiere Products JKPGW System for School Work for Database Management

These codes will show us how we can update our information in our

database.

UPDATE REP

SET LAST_NAME = 'Peter'

WHERE REP_NUM = '65';

These codes will tell us how we can change or delete our data from the

database by using MySQL.

DELETE FROM REP

WHERE REP_NUM = '65';

This code is talking about inserting data.

INSERT INTO CUSTOMER

VALUES

('148','Al''s Appliance and Sport','2837

Greenway','Fillmore','FL','33336',6550.00,7500.00,'20');

INSERT INTO CUSTOMER

VALUES

('282','Brookings Direct','3827 Devon','Grove','FL','33321',431.50,10000.00,'35');

INSERT INTO CUSTOMER

VALUES

('356','Ferguson''s','382 Wildwood','Northfield','FL','33146',5785.00,7500.00,'65');

INSERT INTO CUSTOMER

Page 17: What is the Premiere Products JKPGW System for School Work for Database Management

VALUES

('408','The Everything Shop','1828 Raven','Crystal','FL','33503',5285.25,5000.00,'35');

INSERT INTO CUSTOMER

VALUES

('462','Bargains Galore','3829 Central','Grove','FL','33321',3412.00,10000.00,'65');

INSERT INTO CUSTOMER

VALUES

('524','Kline''s','838 Ridgeland','Fillmore','FL','33336',12762.00,15000.00,'20');

INSERT INTO CUSTOMER

VALUES

('608','Johnson''s Department Store','372

Oxford','Sheldon','FL','33553',2106.00,10000.00,'65');

INSERT INTO CUSTOMER

VALUES

('687','Lee''s Sport and Appliance','282

Evergreen','Altonville','FL','32543',2851.00,5000.00,'35');

INSERT INTO CUSTOMER

VALUES

('725','Deerfield''s Four Seasons','282 Columbia','Sheldon','FL','33553',248.00,7500.00,'35');

INSERT INTO CUSTOMER

VALUES

('842','All Season','28 Lakeview','Grove','FL','33321',8221.00,7500.00,'20');

INSERT INTO ORDERS

Page 18: What is the Premiere Products JKPGW System for School Work for Database Management

VALUES

('21608','2007-10-20','148');

INSERT INTO ORDERS

VALUES

('21610','2007-10-20','356');

INSERT INTO ORDERS

VALUES

('21613','2007-10-21','408');

INSERT INTO ORDERS

VALUES

('21614','2007-10-21','282');

INSERT INTO ORDERS

VALUES

('21617','2007-10-23','608');

INSERT INTO ORDERS

VALUES

('21619','2007-10-23','148');

INSERT INTO ORDERS

VALUES

('21623','2007-10-23','608');

INSERT INTO PART

VALUES

Page 19: What is the Premiere Products JKPGW System for School Work for Database Management

('AT94','Iron',50,'HW','3',24.95);

INSERT INTO PART

VALUES

('BV06','Home Gym',45,'SG','2',794.95);

INSERT INTO PART

VALUES

('CD52','Microwave Oven',32,'AP','1',165.00);

INSERT INTO PART

VALUES

('DL71','Cordless Drill',21,'HW','3',129.95);

INSERT INTO PART

VALUES

('DR93','Gas Range',8,'AP','2',495.00);

INSERT INTO PART

VALUES

('DW11','Washer',12,'AP','3',399.99);

INSERT INTO PART

VALUES

('FD21','Stand Mixer',22,'HW','3',159.95);

INSERT INTO PART

VALUES

('KL62','Dryer',12,'AP','1',349.95);

Page 20: What is the Premiere Products JKPGW System for School Work for Database Management

INSERT INTO PART

VALUES

('KT03','Dishwasher',8,'AP','3',595.00);

INSERT INTO PART

VALUES

('KV29','Treadmill',9,'SG','2',1390.00);

INSERT INTO ORDER_LINE

VALUES

('21608','AT94',11,21.95);

INSERT INTO ORDER_LINE

VALUES

('21610','DR93',1,495.00);

INSERT INTO ORDER_LINE

VALUES

('21610','DW11',1,399.99);

INSERT INTO ORDER_LINE

VALUES

('21613','KL62',4,329.95);

INSERT INTO ORDER_LINE

VALUES

('21614','KT03',2,595.00);

INSERT INTO ORDER_LINE

Page 21: What is the Premiere Products JKPGW System for School Work for Database Management

VALUES

('21617','BV06',2,794.95);

INSERT INTO ORDER_LINE

VALUES

('21617','CD52',4,150.00);

INSERT INTO ORDER_LINE

VALUES

('21619','DR93',1,495.00);

INSERT INTO ORDER_LINE

VALUES

('21623','KV29',2,1290.00);

This is example for MySQL code to select some data from

database.

SELECT REP_NUM, AVG (BALANCE)

FROM CUSTOMER

GROUP BY REP_NUM

ORDER BY REP_NUM;

AND the result is

Page 22: What is the Premiere Products JKPGW System for School Work for Database Management

REP_NUM AVG (BALANCE)

20 9177.666667

35 2203.937500

65 3767.666667

And another example for MySQL code,

SELECT REP_NUM, AVG (BALANCE)

FROM CUSTOMER

GROUP BY REP_NUM

HAVING COUNT (*) < 4

ORDER BY REP_NUM;

The answer is

REP_NUM AVG (BALANCE)

20 9177.666667

65 3767.666667