.SQL PortfolioKevin PulsKNPuls@GMail.com(419) 343-6538<br />Table of Contents TOC o "
h z u The Piggy Bank Project PAGEREF _Toc256677366 h 3 MakeWithdrawal PAGEREF _Toc256677367 h 4 MakeWithdrawal Code PAGEREF _Toc256677368 h 4The Adventure Works Repair Assignment PAGEREF _Toc256677369 h 7 Customer Billing Summary PAGEREF _Toc256677370 h 8 Customer Billing Summary Code PAGEREF _Toc256677371 h 8 Customer Billing Summary Results PAGEREF _Toc256677372 h 9SSIS/SSRS Project PAGEREF _Toc256677373 h 10 ImportProducts.dtsx PAGEREF _Toc256677374 h 11 ImportProducts.dtsx diagram PAGEREF _Toc256677376 h 11 ImportOrders.dtsx PAGEREF _Toc256677377 h 12 ImportOrders.dtsx diagram PAGEREF _Toc256677379 h 12 rptTopSales.rdl PAGEREF _Toc256677381 h 14 rptTopSales.rdl report PAGEREF _Toc256677383 h 14 rptSalesMatrixByYear.rdl PAGEREF _Toc256677384 h 15 rptSalesMatrixByYear.rdl report PAGEREF _Toc256677386 h 15<br />The Piggy Bank Project<br />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.<br />The bank made use of two overdraft types. <br />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.<br />A number of procedures were needed:<br />CreateCustomer, UpdateCustomer, CreateAccount, UpdateAccount, UpdateSavingsInterest, UpdateDailyAverageBalance, MakeDeposit, MakeTransfer, MakeWithdrawal, PayInterest, and FindCustomerInfo <br />The views that were needed are:<br />GetTransactionHistory, GetAccountBalance, and GetCustomerAccounts<br />MakeWithdrawal<br />The MakeWithdrawal procedure (Seen below) was used when customers needed to withdrawal money from Piggy Bank. <br />MakeWithdrawal Code<br />The procedure began with basic parameter checking. Things like missing parameters, non-existents account or customers, inactive account, positive valued withdrawal, and available funds. <br />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. <br />The second main part withdrew the amount from the account(s) and applied any necessary fees. <br />The final part of the procedure only runs when there is an error. It rolls back any changes and displays an error message. <br />The Adventure Works Repair Assignment<br />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: <br />A job is a group of repair items. <br />Each repair item has an associated cost. <br />One job can have multiple repair items. <br />Each job has one customer. <br />Each job has a profit margin. <br />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<br />Customer Billing Summary<br />The report "
Customer Billing Summary"
represents an overview of the billing activity for each customer. The data contains the following fields:<br />Customer name<br />Total number of jobs for this customer which have no payments<br />Total revenue for all jobs for this customer which have no payments<br />Total number of jobs for this customer which have an invoice but no payments<br />Total revenue for all for this customer which have an invoice but no payments<br />Total number of jobs for this customer which are paid in full<br />Total revenue for all jobs for this customer which are paid in full<br />Average revenue for all jobs for this customer which are paid in full<br />Total gross margin for all jobs for this customer which are paid in full<br />Average gross margin for all jobs for this customer which are paid in full<br />The data is sorted by "
Total revenue for all jobs for this customer which are paid in full"
, highest to lowest.<br />Customer Billing Summary Code<br />Customer Billing Summary Results<br />SSIS/SSRS Project<br />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. <br />The SSIS packages were designed to perform the following actions:<br />CreateDatabase.dtsx – Install/reinstall a database with only tables, constraints, and triggers loaded<br />ImportProducts.dtsx – See below<br />ImportVendors.dtsx – Import a list of vendors from a comma delimited file <br />ImportShipMethod.dtsx - Import a list of shipping methods (only new) from a comma delimited file <br />ImportOrders.dtsx – See below<br />ProductPriceIncrease.dtsx – Increase the price of product of a certain type<br />MasterPackage.dtsx – A package designed to run and rerun all the previously listed packages at once<br /> ImportProducts.dtsx<br />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. <br /> <br />ImportProducts.dtsx diagram<br /> ImportOrders.dtsx<br />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. <br />ImportOrders.dtsx diagram<br /> <br /> rptTopSales.rdl<br />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. <br />rptTopSales.rdl report<br /> rptSalesMatrixByYear.rdl<br />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. <br />rptSalesMatrixByYear.rdl report<br />5027930664845<br />