You are on page 1of 17

Glenn Joseph May 27, 2012 MIS 370 Dr.

Delvin Grant

Table of Contents:

Assumptions

Reason for each report

SQL Code

SQL Reports

6-14

Relational Schema

15

Relational Diagram

16

Entity Relational Diagram

17

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.

Why I chose each report: 1. Calculating a contracts 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 clients, 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 consultants 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 clients 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.

SQL Code for each query: 1.


SELECT CONTR_NUM, SUM (CLASS_CHG_HOUR * EST_CONSULT_HOURS) AS TOTAL_CONTRACT_COST FROM CLASS, CONTR_CONSULT_CLASS GROUP BY CONTR_NUM SELECT * FROM CLIENT ORDER BY CLIENT_LNAME SELECT CLIENT_FNAME, CLIENT_MINIT, CLIENT_LNAME, CLIENT_ID, REGION_CODE FROM CLIENT ORDER BY REGION_CODE SELECT CONSULT_FNAME, CONSULT_MINIT, CONSULT_LNAME, CONSULT_ID, REGION_CODE FROM CONSULTANT ORDER BY REGION_CODE SELECT CLIENT_ID, COUNT(CONTR_NUM) AS NUMBER_OF_CONTRACTS FROM CONTRACT GROUP BY CLIENT_ID SELECT CONTR_NUM, CONTR_DATE FROM CONTRACT WHERE CONTR_DATE LIKE '2001%' SELECT CLASS.CLASS_ID, CLASS_DESC, CONSULTANT.CONSULT_ID, CONSULT_FNAME, CONSULT_LNAME FROM CONSULT_CLASS, CLASS, CONSULTANT WHERE CLASS.CLASS_ID = CONSULT_CLASS.CLASS_ID AND CONSULTANT.CONSULT_ID = CONSULT_CLASS.CONSULT_ID ORDER BY CONSULT_LNAME; SELECT CONTRACT.CONTR_NUM, EST_CONSULT_HOURS AS NUMBER_OF_HOURS FROM CONTR_CONSULT_CLASS, CONTRACT WHERE CONTRACT.CONTR_NUM=CONTR_CONSULT_CLASS.CONTR_NUM AND EST_CONSULT_HOURS>150; SELECT COUNT (CONSULT_ID) AS NUMBER_OF_CONSULTANTS, CLASS_ID FROM CONSULT_CLASS GROUP BY CLASS_ID;

2. 3.

4.

5. 6. 7.

8.

9.

Queries: 1. Calculating a contracts total cost

2. List all of Deloittes clients

3.Report listing the clients based on region

4.Report listing the consultants based on region

5.Number of contracts per client

10

6.List all the contracts from the year 2001

11

7.List the consultants in accordance to their skills

12

8.List the contracts that have over 150 hours

13

9.List the number of consultants in each class

14

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

Relational Diagram:

16

Entity Relational Diagram:

17

You might also like