sql ppt portfolio
DESCRIPTION
SQL Server ProjectsTRANSCRIPT
.SQL Portfolio
Name: Stephen SlavenEmail : [email protected]: (407)-287-9984Cell Phone: (856)-340-2766
2/19/2009 1
Table of Contents
• Library Client Application• PiggyBank Project• Library Report Project• BlockFlix Movie Project
2/19/2009 [email protected]
Library Client application
Library Database • Return member info from Member and Adult table• Display available books• Search member info using member number • Use UNION, list all member reserve the specific book• Use CASE, list all member reserve the specific book• Create temporary table• Display members have past due loan use temporary table• Display members who pay highest fine• List of member who want to reserve the specific book
2/19/2009 [email protected]
Library Diagram
2/19/2009 4
Display available books
2/19/2009 5
Use UNION
2/19/2009 6
Display member pay highest fine
2/19/2009 7
Library Stored Procedure
• Add • Add • Check• Check• Add• Convert• Renew• Update
2/19/2009 8
ADD ADULT Stored procedure
2/19/2009 9
CHECK OUT ITEM Stored Procedure
2/19/2009 10
WORKING TEST SCRIPT
2/19/2009 11
Create PiggyBank Database
2/19/2009 12
• DDL - Prevent Drops/Alters to Tables & Views• DML – Prevent Deletes on Adult Table
2/19/2009 13
PiggyBank Triggers
DDL Trigger
2/19/2009 14
2/19/2009 15
DML Trigger
• Add Account• Add Customer• Deposits• Check Balance• Transactions• Update Interest Rates• Search by Customer• Withdrawals2/19/2009 16
PiggyBank Stored Procedure
Add Account Stored Procedure
2/19/2009 17
2/19/2009 18
Add Customer Stored Procedure
2/19/2009 19
Deposits Stored Procedure
2/19/2009 20
Get Balance Stored Procedure
2/19/2009 21
Transactions Stored Procedure
2/19/2009 22
Update Interest Rates Stored Procedure
2/19/2009 23
Search by Customer Name
2/19/2009 24
Withdrawals Stored Procedure
• Complete List of Books• Most Active Members for a month• Kids Reading Club• Current Fines Report• Total Fines by Member
2/19/2009 25
Reports for Library Project
2/19/2009 26
Complete List of Books
2/19/2009 27
Most Active Members for Month
2/19/2009 28
Kids Reading Club Report
2/19/2009 29
Current Fines Report
2/19/2009 30
Total Fines by Member
2/19/2009 31
BlockFlix Project
2/19/2009 32
BlockFlix ERD Diagram
2/19/2009 33
High Availability Corporate headquarters:• Principal server in Omaha, NE• Mirror server in Kansas City, KS• Witness server in Helena, MT
Regional Servers:
Western United States:• Principal Server - Flagstaff, AZ• Mirror Server - Las Vegas, NV• Witness Server - San Antonio, TX
Eastern United States:• Principal Server – Atlanta, GA• Mirror Server – Memphis, TN• Witness Server – Indianapolis, IN
• Corporate Will have a (32-bit) requirement:
1. Server: Windows Small Business Server 2003 Premium Edition SP1
2. There will be 3 servers: 1 Production, 1 Backup, and 1 Witness
3. SQL Server 2005 Enterprise Edition4. Pentium III – compatible processor with 1 GHz processor
speed5. Memory – 2 GB6. Disk Space: 400 GB for Production and Backup and 100 GB
for Witness
2/19/2009 34
Hardware Considerations
• Regional Stores Will have a (32-bit) requirement:
1. Server: Windows Small Business Server 2003 Premium Edition SP1
2. There will be 3 servers: 1 Production, 1 Backup, and 1 Witness
3. SQL Server 2005 Standard Edition4. Pentium III – compatible processor with 1 GHz processor
speed5. Memory – 1 GB6. Disk Space: 200 GB for Production and Backup and 100 GB
for Witness
2/19/2009 35
Hardware Considerations (cont.)
• Regular Stores Will have a (32-bit) requirement: 1. Server: Windows Small Business Server 2003 Premium Edition SP1 2. SQL Server 2005 Standard Edition 3. Pentium III – compatible processor with 1 GHz processor speed 4. Memory – 1 GB 5. Disk Space: 200 GB
2/19/2009 36
Hardware Considerations (cont.)
BlockFlix will be using Redgate’s SQL Backup 3rd party software. SQL Backup will provide the following benefits:1. Compression of backup files up to 90% - saving on backup
space2. Using 256-bit AES encryption will create secure backup
NOTE: We will use this software, until SQL Server 2008 is implemented. When SQL Server will have its own backup encryption. We will at that time evaluate both and determine which is a better backup solution.
Retention of the daily tapes will be Monthly. Retention of the Monthly tapes will be 7 years. Retention of Yearly backup will be indefinite.
2/19/2009 37
Backup Strategy
2/19/2009 38
Maintenance Plan
Task Time Daily/Weekly
Backup DB Differential Every hour Daily
Check Database Integrity 22:00 Daily
Shrink Database 22:30 Daily
Reorganize Indexes 23:00 Daily
Rebuild Indexes 0:00 Weekly – Sunday
Update Statistics 1:00 Weekly - Sunday
Cleanup History 2:00 Weekly - Sunday
Backup BlockFlix and system DBs
3:00 Weekly - Sunday
Backup Transaction Log 5:00 Daily
Maintenance Cleanup 6:00 Weekly - Sunday
2/19/2009 39
Daily Maintenance Plan Diagram
2/19/2009 40
Weekly Maintenance Plan Diagram
2/19/2009 41
Maintenance Plan Email
BlockFlix will need to address the retention of the data long term. We will have backups, but we need the data to be available at all times.
1. We will partition the following tables:A. InventoryB. TransactionsC. CustomerD. MovieE. Rental
2. We will strip off data from the tables that are over 1 year old and send the data to the backup server.
2/19/2009 42
Archival Plan
2/19/2009 43
• Usp_AddStore Results
Stored Procedures
• usp_CheckedOutMovies Results
2/19/2009 44
Stored Procedures (cont.)
• usp_InactiveAccounts Results
2/19/2009 45
Stored Procedures (cont)
• usp_LostDamaged Results
2/19/2009 46
Stored Procedures (cont.)
• usp_Payments Results
2/19/2009 47
Stored Procedures (cont.)
2/19/2009 48
Function – ufn_GetLastDayOfMonth
• Add triggers to prevent inserts, deletes, or updates to tables:
Inventory Movie Rental Store Transactions Talent
• Prevent alters or drops on BlockFlix tables and views
2/19/2009 49
Triggers
• Prevent Store Insert Prevent Store Update
2/19/2009 50
Triggers (cont.)
• Prevent Inventory Delete Prevent Movie Delete
2/19/2009 51
Triggers (cont.)
BlockFlix purchases movies in bulk through the corporate headquarters and distributes them to the stores. The package of movies includes an XML File that contains a list of movies. The XML file will be run by the store to update the following their inventory tables:
- Movie- MovieTalent- Inventory A separate feed from corporate will have already loaded tables:- Talent Type (actors, directors and producers)- Talent- RatingType (G, PG, PG-13, R, NC-17)- Genre (Action, Drama, Chick Flick, Horror, etc)- Store
2/19/2009 52
XML
2/19/2009 53
Demo of XML File
2/19/2009 54
Movie Checkout
2/19/2009 55
Reports
2/19/2009 56
Reports (cont.)
2/19/2009 57
Reports (cont.)
2/19/2009 58
Reports (cont.)
Logins will be assigned using Windows and SQL Server authentication
Roles will be assigned according to user groups specific to their job tasks
Permissions will be set according to their user groups Corporate leaders and store managers will have access to all
servers Employees within corporate such as marketing representatives
will have access only to stored procedures with the necessary privileges to the tables needed to run their reports
Store level employees will be denied changes to the tables and only granted select permissions on tables where necessary to run the stored procedures
2/19/2009 59
Users/Logins/Permissions
through Stored Procedures Prevent SQL Injection attacks Grant most granular permission schema Microsoft Baseline Security Analyzer SQL Server Profiler Maintain Updated Hotfixes or Service Packs
2/19/2009 60
Application Security
2/19/2009 61
Certificates/Encryption
2/19/2009 62
Certificates/Encryption(cont.)
2/19/2009 63
Video Streaming