mis370 database project

19
Glenn Joseph May 27, 2012 MIS 370 Dr. Delvin Grant

Upload: glenn-joseph

Post on 13-Apr-2015

71 views

Category:

Documents


4 download

DESCRIPTION

As a consulting company I needed to structure a database and show the most relevant queries for the business.

TRANSCRIPT

Page 1: MIS370 Database Project

Glenn JosephMay 27, 2012

MIS 370Dr. Delvin Grant

Page 2: MIS370 Database Project

Table of Contents:

Assumptions 3

Reason for each report 4

SQL Code 5

SQL Reports 6-14

Relational Schema 15

Relational Diagram 16

Entity Relational Diagram 17

2

Page 3: MIS370 Database Project

Assumptions:

I am assuming that the company is a consulting firm named Deloitte.

I am assuming that all consultants no matter what their hire-date in the same class are paid the same.

3

Page 4: MIS370 Database Project

Why I chose each report:

1. Calculating a contract’s total cost. The total cost of each contract is a calculated value using the hourly rate and estimated hours to give the exact billed amount to the client.

2. Listing each Deloitte Client. Firms make print-outs of their current clients all the time to analyze how many clients they have, who their clients are, and where they live.

3. Report listing the clients based on region. This query gives you a list of clients based on their region so that the firm can assign a consultant to the right client, this query can also be used to analyze how many clients are in specific regions.

4. Report listing the consultants based on region. This query is useful for the firm to assign a consultant to the client’s, it is used mostly by management.

5. Number of contracts per client. This query will give you a count of how many contracts each individual client has. This is useful to the firm because it can assess which of their clients give them the most business.

6. List all the contracts from the year 2001. Firms like to see which contracts they had signed in a specific year. With this query, the firm can see the contract number as well as the date that the contract was obtained.

7. List the consultants in accordance to their skills. Since many consultants can have multiple skills, this query will list the consultants along with their skills in order of the consultant’s last name.

8. List the contracts that have over 150 hours. A firm can run this query to see which contracts took significantly longer and even give discounts to client’s that are spending more hours.

9. List the number of consultants in each class. This query will show which classes have multiple consultants that possess the skill. Sometimes the firm will use a consultant that usually does a certain task for other tasks because the consultant is proficient in multiple skills.

10. Count the number of contracts that one consultant is working on. This query would essentially tell the firm how many contracts a specific consultant is working on and this is useful because if there is too many contracts in a specific region, they can give contracts to other consultants in the region.

11. How much money did the firm generate in each year. This query would show the total amount of money that the firm received in a specific year. To derive this value I would need to sum up the total amounts of each contract for that specific year.

4

Page 5: MIS370 Database Project

SQL Code for each query:

1. SELECT CONTR_NUM, SUM (CLASS_CHG_HOUR * EST_CONSULT_HOURS) AS TOTAL_CONTRACT_COSTFROM CLASS, CONTR_CONSULT_CLASSGROUP BY CONTR_NUM

2. SELECT *FROM CLIENTORDER BY CLIENT_LNAME

3. SELECT CLIENT_FNAME, CLIENT_MINIT, CLIENT_LNAME, CLIENT_ID, REGION_CODEFROM CLIENTORDER BY REGION_CODE

4. SELECT CONSULT_FNAME, CONSULT_MINIT, CONSULT_LNAME, CONSULT_ID, REGION_CODEFROM CONSULTANTORDER BY REGION_CODE

5. SELECT CLIENT_ID, COUNT(CONTR_NUM) AS NUMBER_OF_CONTRACTSFROM CONTRACTGROUP BY CLIENT_ID

6. SELECT CONTR_NUM, CONTR_DATEFROM CONTRACTWHERE CONTR_DATE LIKE '2001%'

7. SELECT CLASS.CLASS_ID, CLASS_DESC, CONSULTANT.CONSULT_ID, CONSULT_FNAME, CONSULT_LNAMEFROM CONSULT_CLASS, CLASS, CONSULTANTWHERE CLASS.CLASS_ID = CONSULT_CLASS.CLASS_IDAND CONSULTANT.CONSULT_ID = CONSULT_CLASS.CONSULT_IDORDER BY CONSULT_LNAME;

8. SELECT CONTRACT.CONTR_NUM, EST_CONSULT_HOURS AS NUMBER_OF_HOURSFROM CONTR_CONSULT_CLASS, CONTRACTWHERE CONTRACT.CONTR_NUM=CONTR_CONSULT_CLASS.CONTR_NUMAND EST_CONSULT_HOURS>150;

9. SELECT COUNT (CONSULT_ID) AS NUMBER_OF_CONSULTANTS, CLASS_IDFROM CONSULT_CLASSGROUP BY CLASS_ID;

5

Page 6: MIS370 Database Project

Queries:

1. Calculating a contract’s total cost

6

Page 7: MIS370 Database Project

2. List all of Deloittes clients

7

Page 8: MIS370 Database Project

3.Report listing the clients based on region

8

Page 9: MIS370 Database Project

4.Report listing the consultants based on region

9

Page 10: MIS370 Database Project

5.Number of contracts per client

10

Page 11: MIS370 Database Project

6.List all the contracts from the year 2001

11

Page 12: MIS370 Database Project

7.List the consultants in accordance to their skills

12

Page 13: MIS370 Database Project

8.List the contracts that have over 150 hours

13

Page 14: MIS370 Database Project

9.List the number of consultants in each class

14

Page 15: MIS370 Database Project

Relational Schema:

CLIENT(CLIENT_ID, CLIENT_FNAME, CLIENT_MINIT, CLIENT_LNAME, CLIENT_PHONE, CLIENT_ADDRESS, REGION_CODE)

CONTRACT(CONTR_NUM, CONTR_DATE, CLIENT_ID)

CONSULTANT(CONSULT_ID, CONSULT_FNAME, CONSULT_MINIT, CONSULT_LNAME, CONSULT_ PHONE, CONSULT_ ADDRESS, REGION_CODE,CONSULT_START_DATE)

CLASS(CLASS_ID, CLASS_DESC, CLASS_CHG_HOUR)

REGION(REGION_CODE, REGION_DESC)

CONSULT_CLASS(CONSULT_CLASS_ID,CONSULT_ID,CLASS_ID)

CONTR_CONSULT_CLASS(CONTR_CONSULT_CLASS_ID,CONTR_NUM,CONSULT_CLASS_ID, EST_CONSULT_HOURS)

15

Page 16: MIS370 Database Project

Relational Diagram:

16

Page 17: MIS370 Database Project

Entity Relational Diagram:

17