Your SlideShare is downloading. ×
  • Like
My Portfolio
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply
Published

 

Published in Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
542
On SlideShare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
7
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Name: Doug McGlasson Email: [email_address] Phone: (281) 853-4217
  • 2.
    • Introduction
    • RDBMS Project
      • ER Diagram
    • Bank Project
      • ER Diagram
      • Stored procedure- samples
      • Triggers
    Table of Contents
  • 3.
    • Library Project
      • ER Diagram
      • Stored procedure samples
      • SSRS Report - samples
    • Online Movie Project
      • ER Diagram
      • SSIS Sample
      • SSRS Sample report
      • Backup and Recovery Plan
      • Security Considerations
    Table of Contents - cont.
  • 4.
    • This portfolio contains examples of my development work on a variety of real-world projects. The projects were part of a 13-week hands-on training course with the SetFocus Masters Program.
    • SetFocus utilizes Microsoft Official Curriculum in conjunction with its own materials in the following areas:
      • RDBMS
      • Querying using T-SQL
      • SQL Server Integration Services
      • SQL Server Reporting Services
      • Implementing and maintaining a SQL Server 2005 database
    Introduction
  • 5. RDBMS Project This project provided a list of columns and business rules that are to be used as a guide for development of the proposed PiggyBank database. The goal is a database in the third normal form but the developer is allowed to denormalize for a valid business reason. The column list that is provided has redundancies and new columns may be necessary. The developer is to make the best choices for primary and foreign key constraints. The expected deliverable is an ER diagram with crows-foot notation.
  • 6. RDBMS - ER Diagram
  • 7. Bank Project We are given a modified version of the ER diagram we developed earlier and tasked with developing stored procedures for the following: Create new customer and update customer Create new account (savings or checking), update account status and add user Change account status, close account, reactivate account Deposit, Withdrawal and Transfer Overdraft setup (general and specific accounts) ATM procedures Show balance for last five transactions Show transaction history for the last 30 days Additionally create a trigger to prevent drop and alteration of tables plus a trigger to prevent deletes and updates to the transaction table (and any others deemed necessary)
  • 8. Bank Project - ER Diagram
  • 9. Bank Project – Try/Catch Block BEGIN TRY -validate parameters - -state codes are used to send outcome to the caller BEGIN TRANSACTION -set Nocount on to prevent extra results from interfering with select statements BEGIN -body of procedure END COMMIT TRANSACTION END TRY BEGIN CATCH . IF @@TRANCOUNT>0 ROLLBACK TRANSACTION --Declare local variables to hold the error passed back to the caller DECLARE @ERRORMESSAGE NVARCHAR(4000); DECLARE @ERRORSEVERITY INT; DECLARE @ERRORSTATE INT; -- Set the variables to the error values SELECT @ERRORMESSAGE = ERROR_MESSAGE(), @ERRORSEVERITY = ERROR_SEVERITY(), @ERRORSTATE = ERROR_STATE(); --Raise the error to the caller with the error variables RAISERROR (@ERRORMESSAGE, @ ERRORSEVERITY,@ERRORSTATE) END CATCH
  • 10. Bank Project – New Account Procedure BEGIN TRANSACTION -- INSERT INTO ACCOUNT TABLE B EGIN BEGIN INSERT account (AccountTypeID, AccountStatusID,CurrentBalance, O verDraftAccountID, GeneralOverDraft) VALUES (@AccountTypeID, 1, @InitialAmount, @OverDraftAccountID, @GeneralOverDraft) END --Declare local variable to hold the new AccountID -to be used to add new records to the Transactions and CustomerAccount tables declare @newAccountNo int --Set the value to the new AccountID set @newAccountNo=scope_identity() BEGIN -- INSERT INTO TRANSACTIONS TABLE INSERT TRANSACTIONS (AccountID, TransactionTypeID, CustomerID, TransactionDate, TransactionAmount, NewBalance) Values (@NewAccountNo, 1, @CustomerID, getdate(), @InitialAmount, @InitialAmount) END BEGIN --INSERT INTO CUSTOMERACCOUNT TABLE INSERT CustomerAccount (AccountID, CustomerID) VALUES (@newAccountNo, @CustomerID) END END COMMIT TRANSACTION
  • 11. Bank Project – Transfer Funds Procedure BEGIN TRANSACTION SET NOCOUNT ON; declare @BeginOutBalance money set @BeginOutBalance=( SELECT CurrentBalance FROM Account WHERE Accountid=@FromAccountID) BEGIN INSERT Transactions (AccountID, TransactionTypeId, CustomerID, TransactionDate, TransactionAmount, NewBalance) VALUES (@FromAccountId, 4, @CustomerID, Getdate(), @TransferAmount, @BeginOutBalance-@TransferAmount) END DECLARE @NewOutbalance INT SET @NewOutBalance=(@BeginOutBalance-@TransferAmount) BEGIN Update Account SET CurrentBalance=@NewOutBalance WHERE AccountID=@FromAccountID END DECLARE @BeginInBalance money SET @BeginInBalance=( SELECT CurrentBalance FROM Account WHERE Accountid=@ToAccountID) BEGIN INSERT Transactions (AccountID, TransactionTypeId, CustomerID, TransactionDate, TransactionAmount, NewBalance) VALUES (@ToAccountId, 5, @CustomerID, Getdate(), @TransferAmount, @BeginInBalance+@TransferAmount) END DECLARE @NewInBalance INT SET @NewInBalance=(@BeginInBalance+@TransferAmount) BEGIN Update Account SET CurrentBalance=@NewInBalance WHERE AccountID=@ToAccountID END COMMIT TRANSACTION
  • 12. Bank Project – DDL Trigger CREATE TRIGGER tgr_ddl_safe ON DATABASE FOR ALTER_VIEW, DROP_VIEW, ALTER_TABLE, DROP_TABLE AS BEGIN SET NOCOUNT ON --Throw an error RAISERROR('You may not drop or alter database objects.',11,1) IF @@TRANCOUNT>0 BEGIN ROLLBACK TRANSACTION END END
  • 13. Bank Project – DML Trigger CREATE TRIGGER [dbo].[delTransactions] on [dbo].[Transactions] INSTEAD OF DELETE, UPDATE AS BEGIN SET NOCOUNT ON; DECLARE @DeleteCount int; SELECT @DeleteCount=Count(*) from Deleted; if @DeleteCount>0 BEGIN RAISERROR (N'Transactions cannot be deleted or updated.', 10,1); IF @@TRANCOUNT >0 BEGIN ROLLBACK TRANSACTION; END END; END;
  • 14. Library Project A database has been created to support the principal functions of a lending library’s day-to-day operations: adding new members (adult and juvenile), checking books out and in, adding new books, renewing memberships, changing a juvenile record to an adult record once the juvenile reaches 18 and updating adult record information. Books are identified by International Standard Book Number (ISBN). Books with the same title will have different ISBN based upon language and cover type. The library also holds multiple copies of each ISBN. Loan history is considered critical information and must be kept indefinitely. Library memberships are good for one year from issue date. Adults are issued memberships and juveniles are associated with an adult sponsor until they reach 18. Books are checked out for 14 days and members may have only 4 books out at any one time. The deliverable is to create stored procedures to support system functionality and any necessary views and a variety of reports that can be viewed online.
  • 15. Library Project - ER Diagram
  • 16. Library Project – Add New Member Proc BEGIN TRANSACTION BEGIN INSERT MEMBER (LastName, FirstName, MiddleInitial, Photograph) Values (@LastName, @FirstName, @MiddleInitial, @Photograph) END if @@error<> 0 Begin print'Member name information failed' ROLLBACK TRANSACTION Return -8 End Set @newidentity=scope_identity() --STATE HAS DEFAULT CONSTRAINT If @state is null BEGIN INSERT ADULT (Member_no, Street, City, Zip, Phone_no, Expr_date) VALUES (@newidentity, @Street, @City, @Zip, @Phone_no, getdate()+365) END ELSE BEGIN INSERT ADULT (Member_no, Street, City, State, Zip, Phone_no, Expr_date) VALUES (@newidentity, @Street, @City, @State, @Zip, @Phone_no,getdate()+ 365) END if @@error<>0 BEGIN PRINT 'Address insert failed' ROLLBACK TRANSACTION RETURN -9 END Set @member_no=@NEWIDENTITY -- To populate the output parameter COMMIT TRANSACTION RETURN 0 -- SUCCESS
  • 17. Library Project – Check in Item Proc BEGIN TRANSACTION BEGIN UPDATE copy SET on_loan='N'where isbn=@isbn and copy_no=@copy_no END BEGIN INSERT LOANHIST SELECT @isbn,@copy_no,out_date,title_no,member_no, due_date,getdate(),NULL, NULL,NULL,NULL from loan where isbn=@isbn and copy_no=@copy_no END BEGIN delete loan where @isbn=isbn and @copy_no=copy_no END COMMIT TRANSACTION
  • 18. Library Project – Kids Club Report   Beginning Reader June 28 Barr, Angela S Beginning Reader June 28 Barr, Angela K Junior Reader June 28 Anderson, Karl B Junior Reader June 28 Anderson, Jose H Reading Ace August 17 Anderson, Jose A Junior Reader June 28 Anderson, Frank Y Notes Birthday Member Name                                                             7 years old   8 years old   9 years old   Legend:                                     The Kids Club                                    
  • 19. Library Project – Kids Club Procedure SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROC [dbo].[uspKidsClub] AS SELECT (Lastname+', '+firstname+' '+middleinitial) AS membername, cast(datediff(day,(birth_date+.5),Getdate())/(365.25)AS int) AS age, datename(month,Birth_date) AS birthMonth, day(Birth_date) AS DayOfBirth, juvenile.member_no FROM juvenile inner Join member ON member.member_no=juvenile.member_no WHERE datediff(day,(birth_date+.5),Getdate())/(365.25) between 7 and 10 ORDER BY memberName GO
  • 20. Library Project – Most Active Report   4 2009 January 66 Anderson, Linda B   4 2009 January 16 Anderson, Michael A Active Reader 6 2009 January 860 Barr, Angela G Active Reader 9 2009 January 2029 Chen, Amy A Active Reader 9 2009 January 516 Anderson, Shelly R Avid Reader 10 2009 January 2609 Chen, Gary T Avid Reader 11 2009 January 5547 Harui, Gary E Avid Reader 12 2009 January 4955 Graff, Mary Anne H Avid Reader 12 2009 January 302 Anderson, Michael K Reader Status No of checkouts Year Month Member Number Member Name                         For Member Activity January 2009                               Most Active Members Report                               The Library Project                            
  • 21. Library Project – Most Active Procedure CREATE proc [dbo].[uspCheckoutHist] (@Year varchar(4), @Month varchar(15)) AS SELECT (member.lastname+', '+ member.firstname+' '+member.middleInitial) as Fullname, count(out_date)as No_of_checkouts, dateNAME(mm,out_date) as Month, datepart(month,out_date) as mo_int, datepart(year,out_date) as [Year], loanhist.member_no FROM loanhist inner join member ON member.member_no=loanhist.member_no WHERE datepart(year,out_date)=@Year and dateNAME(mm,out_date)=@Month GROUP BY l oanhist.member_no,datename(mm,out_date),datepart(year,out_date), datepart( month,out_date), (member.lastname+', '+ member.firstname+' '+member.middleInitial) ORDER BY count(out_date) DESC,member_no,year desc, mo_int asc
  • 22. Online Movie Project The online movie rental company, BlockFlix, has stores nationwide and is creating a centralized database for tracking inventory, sales, customers and memberships. The stores rent VHS movies, DVD’s and video games as well as selling new and used movies, movie memorabilia, games, game consoles, snack foods and drinks. A new website will be created that uses the database to rent movies online. Database access must be through stored procedures. All inventory is received at one location and distributed to stores. Stores have ancillary kiosk locations in supermarkets and other retail locations that allow member or non-member rentals at $ 1.00 per day per movie. Online and store customers purchase a yearly membership at one of six levels with right to a certain number of movies out at any one time based upon their membership level. Additionally each member will have a queue of movies they would like to be mailed to them as they return movies as specified by their membership level. Management is expecting a high-availability database solution and mandate that all transactions are to be stored indefinitely within the database.
  • 23.  
  • 24.  
  • 25.  
  • 26.  
  • 27.  
  • 28.  
  • 29.  
  • 30.  
  • 31.  
  • 32.
    • Implementation of Mirroring between headquarters server and Mirror server located off site
    • Off site location for archive server to hold legacy data and static information and also acts as the witness for the Mirroring solution
      • The Archive server will be configured as a linked server to both the Principal and the Mirror servers to enable reporting access.
    • Implementation of RAID 5 on production servers
      • High aggregation transfer rates
    • Backup strategies implemented both locally and at corporate levels
  • 33.  
  • 34.
    • Implement Principle of Least Privilege
      • Role based security
      • User management via groups and integrated windows security
      • Stored Procedures for all interactions with data
        • Exclusion of all dynamic SQL statements
      • Use of Certificates and Symmetric Encryption
    • Additional security considerations will be included in the front end applications that interface with the data