Chris Mc Glothen Sql Portfolio
Upcoming SlideShare
Loading in...5
×
 

Chris Mc Glothen Sql Portfolio

on

  • 812 views

My portfolio showing examples of use, creation, and maintenance of SQL Server 2005 database objects.

My portfolio showing examples of use, creation, and maintenance of SQL Server 2005 database objects.

Statistics

Views

Total Views
812
Views on SlideShare
807
Embed Views
5

Actions

Likes
0
Downloads
0
Comments
0

2 Embeds 5

http://www.lmodules.com 4
http://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Chris Mc Glothen Sql Portfolio Chris Mc Glothen Sql Portfolio Presentation Transcript

    • .SQL Portfolio
    • Name: Chris McGlothen
    • Email:
    • [email_address]
    • Phone: (702) 839-9568
  • Table of Contents
    • Bank Project
      • ER Diagram
      • Stored Procedures
      • User Defined Functions
      • Triggers
    • Library Project
      • ER Diagram
      • SSRS Reports
  • Table of Contents (cont.)
    • Online Movie Project
      • ER Diagram
      • XML Schema Collection
      • Shred XML file
      • Backup and Recovery Plan
      • Security Considerations
        • Users/Roles
        • Application
  • Bank Project
    • Introduction:
      • Develop custom stored procedures to manage transactions for a client bank operation.
      • Shred initial data from XML file into database
  • ER Diagram
  • TRY/CATCH Blocks
    • BEGIN TRY
      • --Body of Stored Procedure, including validation and BEGIN TRANSACTION statement
    • END TRY
    • BEGIN CATCH
    • --Rollback the transaction
    • --Perform while loop to close all uncommitted transactions
    • DECLARE @tmpCount int
    • SELECT @tmpCount = CONVERT(int, @@TRANCOUNT)
    • IF @tmpCount >= 0
    • BEGIN
    • WHILE @tmpCount > 0
    • BEGIN
    • ROLLBACK TRAN
    • SET @tmpCount = @tmpCount - 1
    • END
    • END
    • --Declare local variables to hold the error information passes back to the caller
    • DECLARE @Message nvarchar(4000);
    • DECLARE @Severity int;
    • DECLARE @State int;
    • --Set the variables to the error values
    • SELECT
    • @Message = ERROR_MESSAGE(),
    • @Severity = ERROR_SEVERITY(),
    • @State = ERROR_STATE();
    • --Raise the error to the caller with the error variables
    • RAISERROR(@Message, @Severity, @State)
    • RETURN -1
    • END CATCH
  • Debit Account Procedure
  • Transfer Funds Procedure
  • Interest with Avg. Daily Balance
  • Get Customer Data w/ Dynamic WHERE Clause
    • CREATE PROCEDURE uspGetCustomer
    • @AccountID int = NULL -- NULL
    • , @CustomerID int = NULL -- NULL
    • , @Name varchar(50) = NULL -- NULL
    • , @Phone varchar(12) = NULL -- NULL
    • AS
    • BEGIN TRY
    • --Use the ISNULL function to create a dynamic WHERE clause
    • SELECT *
    • FROM vwCustomers
    • WHERE AccountID = ISNULL(@AccountID, AccountID)
    • AND CustomerID = ISNULL(@CustomerID, CustomerID)
    • AND [Name] LIKE ISNULL('%' + @Name + '%', '%')
    • AND (HomePhone LIKE ISNULL('%' + @Phone + '%', '%')
    • OR WorkPhone LIKE ISNULL('%' + @Phone + '%', '%')
    • OR CellPhone LIKE ISNULL('%' + @Phone + '%', '%'))
    • ORDER BY TransactionDate DESC
    • END TRY
  • Calculate Monthly Interest Function
    • CREATE FUNCTION [dbo].[ufnCalcMonthlyInterest] ( @Balance money, @ID int, @AcctType tinyint )
    • RETURNS money
    • AS
    • BEGIN
    • DECLARE @InterestToBeAdded money
    • DECLARE @MonthlyRate decimal(6,6)
    • SET @MonthlyRate = ((SELECT InterestRate FROM AccountType WHERE AccountTypeID = @AcctType) / 12)
    • SET @InterestToBeAdded = (SELECT (@Balance * @MonthlyRate) FROM Account WHERE AccountID = @ID)
    • RETURN @InterestToBeAdded
    • END
  • DDL Trigger
    • CREATE TRIGGER tgrSafety
    • ON DATABASE
    • FOR DROP_TABLE, ALTER_TABLE, DROP_VIEW, ALTER_VIEW
    • AS
    • BEGIN
    • SET NOCOUNT ON;
    • --Throw an error
    • RAISERROR ('You may not drop or alter objects from this database.', 11,1)
    • IF @@TRANCOUNT > 0
    • BEGIN
    • --Rollback the transaction
    • ROLLBACK TRANSACTION
    • END
    • END
  • DML Trigger
    • CREATE TRIGGER tgrGuardTransactions
    • ON Transactions INSTEAD OF DELETE, UPDATE
    • AS
    • BEGIN
    • --Throw an error
    • RAISERROR ('Deletions and Updates not allowed from this table (source = instead of)', 11, 1)
    • IF @@TRANCOUNT > 0
    • BEGIN
    • --Rollback the transaction
    • ROLLBACK TRANSACTION
    • END
    • END
  • Library Project
    • Introduction:
      • Develop custom SSRS reports for an existing database management system
  • ER Diagram
  • Most Active Members by Month and Year
  • Active Member Report Procedure
    • CREATE PROCEDURE [dbo].[uspGetActiveMembers]
    • @Month int
    • , @Year int
    • AS
    • DECLARE @LoanTable TABLE
    • (
    • MemberNo int
    • , FullName varchar(100)
    • , OutDate datetime
    • , CurrentLoan bit
    • )
    • INSERT INTO @LoanTable
    • SELECT m.Member_No
    • , (m.FirstName + ' ' + ISNULL(m.MiddleInitial + ' ', '') + m.LastName)
    • , lh.Out_Date
    • , 0
    • FROM Member m
    • INNER JOIN LoanHist lh
    • ON m.Member_No = lh.Member_No
    • UNION
    • SELECT m.Member_No
    • , (m.FirstName + ' ' + ISNULL(m.MiddleInitial + ' ', '') + m.LastName)
    • , l.Out_Date
    • , 1
    • FROM Member m
    • INNER JOIN Loan l
    • ON m.Member_No = l.Member_No
    • SELECT MemberNo, FullName, COUNT(*) AS TotalLoans
    • FROM @LoanTable lt
    • WHERE MONTH(OutDate) = @Month AND YEAR(OutDate) = @Year
    • GROUP BY MemberNo, FullName
    • ORDER BY TotalLoans DESC
  • Current Fines Report
  • Current Fine Report Procedure
    • CREATE PROCEDURE [dbo].[uspCurrentOverDue]
    • AS
    • SELECT CONVERT(varchar, l.Due_Date, 110) AS Due_Date
    • , DATEDIFF(dd, l.Due_Date, GETDATE()) AS DaysOverDue
    • , CAST((DATEDIFF(dd, l.Due_Date, GETDATE()) * .25) AS money) AS FineDue
    • , l.ISBN
    • , t.Title
    • , (m.FirstName + ' ' + ISNULL(m.MiddleInitial + ' ', '') + m.LastName) AS FullName
    • FROM Loan l
    • INNER JOIN Title t
    • ON l.Title_No = t.Title_No
    • INNER JOIN Member m
    • ON l.Member_No = m.Member_No
    • WHERE DATEDIFF(dd, l.Due_Date, GETDATE()) >0
    • ORDER BY FullName
  • Kids Club Report
  • Kids Club Report Procedure
    • CREATE PROCEDURE [dbo].[uspGetKids]
    • AS
    • DECLARE @KidsTable TABLE
    • (
    • MemberNo int
    • , FullName varchar(100)
    • , Age int
    • )
    • INSERT INTO @KidsTable
    • (
    • MemberNo
    • , FullName
    • , Age
    • )
    • SELECT j.Member_No, (m.FirstName + ' ' + ISNULL(m.MiddleInitial + ' ', '') + m.LastName) AS FullName, 7 AS Age
    • FROM Juvenile j
    • INNER JOIN Member m ON j.Member_No = m.Member_No
    • WHERE j.Birth_Date BETWEEN (CAST(MONTH(GETDATE()) AS varchar) + '/' + CAST(DAY(GETDATE() + 1)AS varchar) + '/' + CAST((YEAR(DATEADD(yy, -8, GETDATE()))) AS varchar))
    • AND CAST(MONTH(GETDATE()) AS varchar) + '/' + CAST(DAY(GETDATE())AS varchar) + '/' + CAST((YEAR(DATEADD(yy, -7, GETDATE()))) AS varchar)
    • UNION
    • SELECT j.Member_No, (m.FirstName + ' ' + ISNULL(m.MiddleInitial + ' ', '') + m.LastName) AS FullName, 8 AS Age
    • FROM Juvenile j
    • INNER JOIN Member m ON j.Member_No = m.Member_No
    • WHERE j.Birth_Date BETWEEN (CAST(MONTH(GETDATE()) AS varchar) + '/' + CAST(DAY(GETDATE() + 1)AS varchar) + '/' + CAST((YEAR(DATEADD(yy, -9, GETDATE()))) AS varchar))
    • AND CAST(MONTH(GETDATE()) AS varchar) + '/' + CAST(DAY(GETDATE())AS varchar) + '/' + CAST((YEAR(DATEADD(yy, -8, GETDATE()))) AS varchar)
    • UNION
    • SELECT j.Member_No, (m.FirstName + ' ' + ISNULL(m.MiddleInitial + ' ', '') + m.LastName) AS FullName, 9 AS Age
    • FROM Juvenile j
    • INNER JOIN Member m ON j.Member_No = m.Member_No
    • WHERE j.Birth_Date BETWEEN (CAST(MONTH(GETDATE()) AS varchar) + '/' + CAST(DAY(GETDATE() + 1)AS varchar) + '/' + CAST((YEAR(DATEADD(yy, -10, GETDATE()))) AS varchar))
    • AND CAST(MONTH(GETDATE()) AS varchar) + '/' + CAST(DAY(GETDATE())AS varchar) + '/' + CAST((YEAR(DATEADD(yy, -9, GETDATE()))) AS varchar)
    • SELECT *
    • FROM @KidsTable
    • ORDER BY Age
  • Online Movie Project
    • Introduction:
      • Design and implement DBMS for a movie rental chain
        • Database Design and Implementation
        • Stored Procedures
        • SSRS Reports
        • Backup and Recovery Plan
        • Database Security Strategy
  • ER Diagram
  • ER Diagram (cont.)
  • ER Diagram (cont.)
  • XML Schema Collection
  • XML File
  • Shredding the data
  • Backup and Recovery
    • Implementation of Log Shipping between headquarters server and secondary server located off site
    • Off site location for archive server to hold legacy data and static information and also acts as the monitor for the Log Shipping solution
    • Implementation of RAID 5 on production servers
    • High aggregation transfer rates
    • Backup strategies implemented both locally and at corporate levels
  • Backup and Recovery (cont.)
  • Security Considerations
    • 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