kevin bengtson portfolio

Post on 17-May-2015

1.618 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

SQL Portfolio

Kevin BengtsonKevin.Bengtson@live.com763-898-3453

Table of Contents

• PiggyBank Project – Database T-SQL design• Junglebooks T-SQL Queries• Library T-SQL Queries• SQL Server Administative Tasks Project• MiniAdventureWorks SSIS/SSRS• BlockFlix Final Group Project• What is SetFocus?

Piggybank Project

• Introduction: Given a set of columns to be used in a banking database, determine which columns are necessary. Create the database using SSMS.

• Project Goals: Develop a database and the appropriate Stored Procedures to access the data. Create testscripts to test the procecdures

Project Sample – Database Diagram

Project Sample – Create Account• USE [PiggyBank1]• GO

• /****** Object: Table [dbo].[Account] Script Date: 04/01/2010 15:53:47 ******/• SET ANSI_NULLS ON• GO

• SET QUOTED_IDENTIFIER ON• GO

• CREATE TABLE [dbo].[Account](• [AccountID] [int] IDENTITY(1,1) NOT NULL,• [AccountTypeID] [tinyint] NOT NULL,• [AccountStatusID] [tinyint] NOT NULL,• [CurrentBalance] [money] NOT NULL,• [OverDraftAccountID] [int] NULL,• [GeneralOverdraft] [bit] NULL,• CONSTRAINT [PK_Account] PRIMARY KEY CLUSTERED • (• [AccountID] ASC• )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]• ) ON [PRIMARY]• GO

• ALTER TABLE [dbo].[Account] WITH CHECK ADD CONSTRAINT [FK_Account_AccountStatus] FOREIGN KEY([AccountStatusID])• REFERENCES [dbo].[AccountStatus] ([AccountStatusID])• GO

• ALTER TABLE [dbo].[Account] CHECK CONSTRAINT [FK_Account_AccountStatus]• GO

• ALTER TABLE [dbo].[Account] WITH CHECK ADD CONSTRAINT [FK_Account_AccountType] FOREIGN KEY([AccountTypeID])• REFERENCES [dbo].[AccountType] ([AccountTypeID])• GO

• ALTER TABLE [dbo].[Account] CHECK CONSTRAINT [FK_Account_AccountType]• GO

Project Sample – Create Customer• USE [PiggyBank1]• GO

• /****** Object: Table [dbo].[Customer] Script Date: 04/01/2010 15:52:43 ******/• SET ANSI_NULLS ON• GO

• SET QUOTED_IDENTIFIER ON• GO

• SET ANSI_PADDING ON• GO

• CREATE TABLE [dbo].[Customer](• [CustomerID] [int] IDENTITY(1,1) NOT NULL,• [CustomerFirstName] [varchar](20) NOT NULL,• [CustomerLastName] [varchar](30) NOT NULL,• [CustomerMiddleInitial] [varchar](1) NULL,• [Street] [varchar](50) NOT NULL,• [City] [varchar](20) NOT NULL,• [State] [char](2) NOT NULL,• [ZipCode] [char](10) NOT NULL,• [Email] [varchar](30) NULL,• [HomePhone] [char](12) NOT NULL,• [WorkPhone] [char](12) NULL,• [CellPhone] [char](12) NULL,• CONSTRAINT [PK_Customer] PRIMARY KEY CLUSTERED • (• [CustomerID] ASC• )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]• ) ON [PRIMARY]

• GO

• SET ANSI_PADDING OFF• GO

Project Sample – ATMGetTransactions

• USE [PiggyBank1]• GO

• /****** Object: StoredProcedure [dbo].[ATMGetTransactions] Script Date: 04/01/2010 16:08:33 ******/• SET ANSI_NULLS ON• GO

• SET QUOTED_IDENTIFIER ON• GO

• --=============================================• -- ATMGetTransactions• -- Author: Kevin Bengtson• -- Create date: 1/26/2010• -- Description: Get the transaction history for• -- the last 30 days• -- =============================================• create procedure [dbo].[ATMGetTransactions]• -- The set of input parameters.• @AccountID int• as• begin• select convert(varchar(30), t.TransactionDate, 101) as Date, t.TransactionTypeName as Type, t.TransactionAmount, t.NewBalance • from dbo.v_Transaction_Info t• where t.AccountID = @AccountID AND t.TransactionDate >= DATEADD(day, -30, getdate())• order by t.TransactionDate desc• end

• GO

• GO

Project Sample – Screenshot testscripts

T-SQL Queries Project

• Introduction: Given two databases, Library and Junglebooks, deliver T-SQL Queries to perform specific functions.

• Project Goals: Develop Queries to access the data and print it out.

T-SQL Queries Project - Samples• Introduction: Given two databases, Library and Junglebooks, deliver Queries to perform specific functions.• use JungleBooks

• --TSQL1 #1

• SELECT ISBN, title, publisher • FROM dbo.Books• WHERE UnitPrice < 15• ORDER BY title

• --TSQL1 #2

• SELECT Name as 'Search Results' • FROM dbo.Authors• WHERE LOWER(name) like '%pet%'• ORDER BY Name

• --TSQL1 #3• SELECT • CustomerId as 'Cust ID',• OrderId as 'Order #',• OrderDate as 'Order Date'• FROM dbo.Orders• WHERE CustomerId BETWEEN 6 and 15• ORDER BY CustomerId•

• Project Goals: Develop Queries to access the data and print it out. Create testscripts to test the procecdures

T-SQL Queries Project - Samples

• use library

• -- Task 1

• select m.firstname + ' ' + m.middleinitial + ' ' + m.lastname as Name,• a.street, • a.city,• a.state,• a.zip• from dbo.adult a inner join dbo.member m• on a.member_no = m.member_no• -- where m.middleinitial is not null• order by m.lastname, m.firstname

• -- Task 2

• select i.isbn,• c.copy_no,• c.on_loan,• t.title as Title,• i.translation,• i.cover• from dbo.item i inner join dbo.copy c• on i.isbn = c.isbn• inner join dbo.title t• on c.title_no = t.title_no• where (i.isbn = 500 or i.isbn = 1000) AND• c.on_loan <> 'Y'• order by i.cover

T-SQL Queries Project - Screenshots

T-SQL Queries Project - Screenshots

SQL Server Administrative Tasks

Introduction : Project includes implementing different including :

• Install and Configure SQL Server 2008 Practical Exercise• Manage Database Files• Resizing Files and Modifying Database Properties• Policy-Based Management• Implementing Disaster Recovery Procedures• Database Snapshots• Working with Schemas• Implementing Security• Schema Permissions

SQL Server Administrative Tasks

• Auditing Database Role Membership• Exporting and Importing Data• Weekly Integrity Checks• Transaction Log Approaching Capacity• Monitoring CREATE TABLE statements• Ownership Chaining• Resource Governor• Data Collector• Database Mirroring• Replication

Administrative Tasks Screenshots

Administrative Tasks Screenshots

Administrative Tasks Screenshots

Administrative Tasks Screenshots

Administrative Tasks Screenshots Query History Report

Administrative Tasks Screenshots Query History Report

SSIS-SSRS-TSQL Project

Introduction : Create MiniAdventureWorksDB Database using SSIS. Build Routines in SSIS to execute procedures.

SSIS-SSRS-TSQL Project

• SSIS Project Packages• CreateDatabase.dtsx• ImportProducts.Dtsx• ImportVendors.Dtsx• ImportShipMethod.Dtsx• ImportOrders.Dtsx• MasterPackage.Dtsx

SSIS-SSRS-TSQL Project

• SSRS Report Packages• rptTopSales.rdl• rptSalesMatrixByYear.rdl

SIS-SSRS-TSQL Project Screenshots

Team Members: Kevin Puls – Project ManagerKevin Bengtson – Assistant Project ManagerJose SuarezVincent Doyle

BlockFlix Database Layout

*No deletes allowed on transaction table

• XML file example

• Add Movie SSIS Demo

XML Movie Import

XML Movie Import - Functions

• Usp_AddMovie• Input movie title, year, genre ID, and rating ID• Will not re-enter duplicate

• Usp_AddCast• Input cast member first and last name• Will not re-enter duplicates

• Usp_AddMovieCast• Input movie ID, cast ID, and cast type ID• Will not re-enter duplicates

• Usp_AddInventory• Input movie ID, location ID, inventory type ID, rentable,

quantity, cost, and condition ID

Transaction Procedure – Usp_RentMovie

Transaction Procedure – Usp_RentMovie (Page 2)

Additional Transaction Procedures

• Usp_ReturnMovie• Input SKU• Returns movie to inventory (Set quantity back to 1)• Subtracts 1 from the account’s checked-out amount

• Usp_BuyMovie• Input SKU• Optional Input Customer ID and Account ID• Make an entry for the Transaction table• Remove from the Inventory table• Delete movie from database if not copies are available

• Usp_MoveSell• Input SKU• Put a rented item up for sale • Will not work for Kiosks

Account Payment Procedures - Usp_LostInventory

Account Payment Procedures - Usp_LostInventory (Page2)

• Usp_MakeOverdue• Queries all active accounts• Closes accounts that are 30 days overdue

• Usp_MakePayment• Input customer ID, account ID, transaction type ID• Determine membership type / fee amount • Update fee balance in account table• Reopens account if balance is paid in full

Additional Account Payment Procedures

• Usp_CreateCustomer• Input first name, last name, middle initial, street, city,

state, zip code, e-mail, phone

• Usp_ModifyCustomer• Input first name, last name, middle initial, street, city,

state, zip code, e-mail, phone

• Usp_CreateAccount• Input customer ID, membership type ID, account status ID

• Usp_ModifyAccount• Input customer ID, membership type ID, account status ID

Customer Account Procedures

• Usp_QueueAdd• Input account ID and list ID (Movie or game ID)• Adds a game or movie to an account’s queue

• Usp_QueueAdjust• Input account ID, list ID 1, list ID 2 • Swaps the positions of two items in a queue

• Usp_QueueSubtract• Input account ID and list ID• Removes a game or movie from an account’s queue• Reorders the remaining items in the queue

Customer Account Procedures (Page 2)

Requested Reports

Requested Reports (Page 2)

Requested Reports (Page 3)

• Usp_ShowMovieInventory• Input location ID• Returns a list of all movies at the given location

• Full Backup• Every week

• Differential Backup• Every day

• Transaction Backup• Every 1 hour

• Rebuild Indexes• Every week

• Update Statistics• Every week

• Clean History• Every week

• Maintenance Cleanup• Every week

Backup and Maintenance Plan

• Dell PowerEdge 11G R610• Two Quad-Core Intel® Xeon® 5500 series processors • 96GB (12 DIMM slots/6 per-processor): 8GB DDR3

1333MHz memory • Windows Server® 2008 R2 Enterprise

• Datacenter Cluster• 12 Server blades • 48 Gigs of RAM per blade• 3 TB of storage per blade• Windows Server® 2008 R2 Datacenter

• Data uploading to BlockFlix Master• SSIS nightly uploads• Upload all

– Transactions – Inventory/Inventory Lost– New customer information

• Full Game functionality • All the same functions that are available to movies

Unimplemented Components

• Video Streaming • Separate server with large disk space to store the

movies in and filestream them out. • Database would need to be changed to keep track of

Video Stream movies.

• Throttling• Database modification is already in place• Modification of Usp_RentMovie is needed

• Movie Search• Be able to do a fuzzy search on Title or Cast Name and

return all movies

Possible Expansion

What is SetFocus?• The SetFocus SQL Master’s Program is an intensive, hands–

on, project oriented program allowing knowledge and valuable experience putting the SQL skill set to use in a simulated work environment.

• I received over 300 hours of in-depths hands on experience

focused on SQL Development.

• SetFocus projects are real world projects that are distributed just as I would receive in a position. I received project specifications and was expected to identify best courses of action with deadlines set for completion.

top related