Porfolio of Setfocus work

18
.SQL Portfolio Kevin Puls [email protected] m (419) 343-6538

description

 

Transcript of Porfolio of Setfocus work

Page 1: Porfolio of Setfocus work

.SQL Portfolio

Kevin Puls

[email protected]

(419) 343-6538

Page 2: Porfolio of Setfocus work

Table of ContentsThe Piggy Bank Project...........................................................................................................................3

MakeWithdrawal.................................................................................................................................4

MakeWithdrawal Code........................................................................................................................4

The Adventure Works Repair Assignment..........................................................................................7

Customer Billing Summary.............................................................................................................8

Customer Billing Summary Code.........................................................................................................8

Customer Billing Summary Results......................................................................................................9

SSIS/SSRS Project...................................................................................................................................10

ImportProducts.dtsx......................................................................................................................11

ImportProducts.dtsx diagram......................................................................................................11

ImportOrders.dtsx..........................................................................................................................12

ImportOrders.dtsx diagram..........................................................................................................12

rptTopSales.rdl...............................................................................................................................14

rptTopSales.rdl report...................................................................................................................14

rptSalesMatrixByYear.rdl.............................................................................................................15

rptSalesMatrixByYear.rdl report.................................................................................................15

Page 3: Porfolio of Setfocus work

The Piggy Bank Project

The goal of this project was to implement a functioning bank database. All outside interaction with the database is done with user stored procedures and views. DDL Triggers were also implemented to prevent deletions.

The bank made use of two overdraft types. One type is specific overdraft. A specific overdraft account could be set up for customers with more than one account who wished to use one in case of overdrafts. The other type was a general overdraft. The general overdraft allows a max overdraft of $400 not counting fees. The specific overdraft fee is $10 while the general overdraft fee is $30. It is possible for the customer to use both (Not on the same transaction) or neither. Also the date in which an account went into overdraft needed to be logged.

A number of procedures were needed:CreateCustomer, UpdateCustomer, CreateAccount, UpdateAccount, UpdateSavingsInterest, UpdateDailyAverageBalance, MakeDeposit, MakeTransfer, MakeWithdrawal, PayInterest, and FindCustomerInfo

The views that were needed are:GetTransactionHistory, GetAccountBalance, and GetCustomerAccounts

MakeWithdrawal

Page 4: Porfolio of Setfocus work

The MakeWithdrawal procedure (Seen below) was used when customers needed to withdrawal money from Piggy Bank.

MakeWithdrawal CodeThe procedure began with basic parameter checking. Things like missing parameters, non-existents account or customers, inactive account, positive valued withdrawal, and available funds.

Page 5: Porfolio of Setfocus work

The main body of the procedure consisted of two parts. The first part determined which accounts (If any) were to be charged. It also determined the type of overdraft (If any) that was to be used.

Page 6: Porfolio of Setfocus work

The second main part withdrew the amount from the account(s) and applied any necessary fees.

The final part of the procedure only runs when there is an error. It rolls back any changes and displays an error message.

Page 7: Porfolio of Setfocus work

The Adventure Works Repair Assignment

The goal of this project assignment was to design SQL queries to provide the three unformatted reports requested. It was also necessary to design the database from the following specifications:

A job is a group of repair items. Each repair item has an associated cost. One job can have multiple repair items. Each job has one customer. Each job has a profit margin. Each job moves through a workflow marked by a date: Date in , bid date, quote

approved date, PO issued date, invoice date, paid in full

Page 8: Porfolio of Setfocus work

Customer Billing Summary

The report "Customer Billing Summary" represents an overview of the billing activity for each customer. The data contains the following fields:

Customer name Total number of jobs for this customer which have no payments Total revenue for all jobs for this customer which have no payments Total number of jobs for this customer which have an invoice but no payments Total revenue for all for this customer which have an invoice but no payments Total number of jobs for this customer which are paid in full Total revenue for all jobs for this customer which are paid in full Average revenue for all jobs for this customer which are paid in full Total gross margin for all jobs for this customer which are paid in full Average gross margin for all jobs for this customer which are paid in full

The data is sorted by "Total revenue for all jobs for this customer which are paid in full", highest to lowest.

Customer Billing Summary Code

Page 9: Porfolio of Setfocus work

Customer Billing Summary Results

Page 10: Porfolio of Setfocus work

SSIS/SSRS Project

The goal of this project was to design several SSIS (SQL Server Integration Services) packages that created a database called MiniAdventureWorksDB and then import data into the database. The database structure was given as well as the several comma delimited files to import data from. Futhermore, SSRS (SQL Server Reporting Services) was used to create two reports (See below) using the imported data. The rptSalesMatixByYear was deployed using the SSRS Report Manager. With Report Manager it was auto-run, auto-emailed, and had a history stored.

The SSIS packages were designed to perform the following actions: CreateDatabase.dtsx – Install/reinstall a database with only tables, constraints, and

triggers loaded ImportProducts.dtsx – See below ImportVendors.dtsx – Import a list of vendors from a comma delimited file ImportShipMethod.dtsx - Import a list of shipping methods (only new) from a comma

delimited file ImportOrders.dtsx – See below ProductPriceIncrease.dtsx – Increase the price of product of a certain type MasterPackage.dtsx – A package designed to run and rerun all the previously listed

packages at once

Page 11: Porfolio of Setfocus work

ImportProducts.dtsx

The ImportProducts package imports products from a comma delimited file. The package takes these products and either inserts or updates them. Updates will only work if a product has been modified. The package also emails the results to a specified recipient.

ImportProducts.dtsx diagram

Page 12: Porfolio of Setfocus work

ImportOrders.dtsx

The ImportOrders package imports order details and header information from any number of comma delimited file with the format PODATA_*.CSV to the proper table (POHeader or PODetail). The package moves the processed files to another folder. Orders that do not have an associated vendor or product are output to a separate file that is emailed to a specified recipient. The results of the run are also emailed.

ImportOrders.dtsx diagram

Page 13: Porfolio of Setfocus work
Page 14: Porfolio of Setfocus work

rptTopSales.rdl

This report shows the total sales per vendor and per product for a user defined range of years. Vendors are ranked from most to least sales dollars. The vendor’s top products are also ranked by sales dollars. The max rank for both vendors and products are user defined.

rptTopSales.rdl report

Page 15: Porfolio of Setfocus work

rptSalesMatrixByYear.rdl

This report shows the vendor sales per year. The report also shows the totals per year and per vendor, and it has a grand total. The report can be filtered by shipping method.

rptSalesMatrixByYear.rdl report