Sunday, December 28, 2014

SQL Server 2014 Course Content

SQL Server 2014 Training Course Overview
SQL Server Training Course Prerequisite
  • No Prior Experience is required
SQL Server Training Course Duration
  • 40 Working days, daily one hour
SQL Server 2014 Training Course Overview

Introduction To DBMS
·         File Management System And Its Drawbacks
·         Database Management System (DBMS) and Data Models
·         Relationships in Sql Server

Introduction To SQL Server
·         Advantages and Drawbacks Of SQL Server Compared To Oracle And DB2
·         SQL Server Installation.
·         Connecting To Server
·         Server Type
·         Server Name
·         Authentication Modes
·         Sql Server Authentication Mode
·         Windows Authentication Mode
·         Login and Password
·         Sql Server Management Studio and Tools In Management Studio
·         Object Explorer
·         Object Explorer Details
·         Query Editor
TSQL (Transact Structured Query Language)
Introduction To TSQL
·         History and Features of TSQL
·         Types Of TSQL Commands
·         Data Definition Language (DDL)
·         Data Manipulation Language (DML)
·         Data Query Language (DQL)
·         Data Control Language (DCL)
·         Transaction Control Language (TCL)

Data Definition Language(DDL)
·         Database
·         Creating Database
·         Altering Database
·         Deleting Database
·         Constrains
·         Procedural Integrity Constraints
·         Declarative Integrity Constraints
·         Not Null, Unique, Default and Check constraints
·         Primary Key and Referential Integrity or foreign key constraints
·         Delete and update Rules in Foreign Key
1.     On update/delete no action
2.     On update/delete cascade
3.     On update/delete set null
4.     On update/delete set default

·         Data Types In TSQL
·         Table
·         Creating Table
·         Altering Table
·         Dropping Table
Data Manipulation Language(DML)
·         Insert
·         Identity
·         Creating A Table From Another Table
·         Inserting Rows From One Table To Another
·         Update
·         Computed Columns
·         Delete
·         Truncate
·         Differences Between Delete and Truncate
·         Merge Statement
Data Query Language (DQL)
·         Select
·         Where clause
·         Order By Clause
·         Distinct Keyword
·         Isnull() function
·         Column & table aliases
Operators:
·         Arithmetic operators
·         comparison operators
·         range operators
·         list operators
·         string /pattern matching operator
·         unknown value operators
·         logical operators
·         set operators
Built In Functions
·         Scalar Functions
·         Numeric Functions
·         Character Functions
·         Conversion Functions
·         Date Functions
Aggregate Functions
·         Convenient Aggregate Functions
·         Statistical Aggregate Functions
·         Group By and Having Clauses
·         Super Aggregates
·         Over(partition by …) Clause
·         Ranking Functions
v  Rank()
v  Dense_rank()
v  Row_Number()
v  Ntile(n)
Table Expressions

·         Derived tables
·         Common Table Expressions (CTE)
Top n Clause
Joins
·         Inner Join
·         Equip Join
·         Non-Equi Join
·         Self Join
·         Outer Join
·         Left Outer Join
·         Right Outer Join
·         Full Outer Join
·         Cross Join
Sub Queries
·         Single Row Sub Queries
·         Multi Row Sub Queries
·         Any or Some
·         ALL
·         Nested Sub Queries
·         Co-Related Sub Queries
·         Exists and Not Exists
Indexes
·         Clustered Index
·         NonClustered Index
·         Create , Alter and Drop Indexes
·         Creating indexed view
·         Using Indexes
Security
·         Login Creation
·         SQL Server Authenticated Login
·         Windows Authenticated Login
·         User Creation
·         Granting Permissions
·         Revoking Permissions
Schema
·         Creating a schema
·         Creating an object under schema
·         Alterring a schema
·         Droping a schema
·         Providing security to schemaa
Views
Purpose Of Views
·         Creating , Altering and Dropping Views
·         Simple and Complex Views
·         Updating(insert/delete/update)  the views
·         With check option
·         Encryption and Schema Binding Options in creating views
Transaction Management-(TCL)
 Introduction
·         Explicit Transactions
·         Begin Transaction
·         Commit Transaction
·         Rollback Transaction
·         Save Transaction
·         Implicit Transactions
TSQL Programming (like PL/SQL in Oracle)
·         Drawbacks Of TSQL that leads to TSQL Programming
·         Introduction To TSQL Programming
·         Control statements In TSQL Programming
·         Conditional Control Statements
·         If
·         Case
·         Looping Control Statements
·         While
Cursors
·         Working With Cursors
·         Types Of Cursors
·         Forward_Only and Scroll Cursors
·         Static, Dynamic and Keyset Cursors
·         Local and Global Cursors
·         Cursors with functions, procedures and triggers(will be dealt at the end)
Stored Sub Programs
·         Advantages Of Stored Sub Programs compared to Independent SQL Statements
·         Stored Procedures
·         Creating , Altering and Dropping
·         Optional Parameters
·         Input and Output Parameters
·         Permissions on Stored Procedures
·         User Defined Functions
·         Creating, Altering and Dropping
·         Types Of User Defined Functions
·         Scalar Functions
·         Table Valued Functions
·         Inline Table Valued Functions
·         Multi Statement Table Valued Functions
·         Permissions On User Defined Functions
·         Diff between fucntions and procedures
·         Triggers
·         Purpose of Triggers
·         Differences Between Stored Procedures and User Defined Functions and Triggers
·         Creating, Altering and Dropping Triggers
·         After Triggers
·         Magic Tables
·         Instead Of Triggers
·         Updating the complex view using instead of triggers
·         Exception Handling
·         Implementing Exception Handling
·         Try –catch mechanism
·         Adding and removing User Defined Error Messages To And From SQL Server Error Messages List
·         Raising Exceptions Manual
·         Generating Errors through throws key word
Normalization
·         First Normal Form
·         Second Normal Form
·         Third Normal Form
·         Boyce-Codd Normal Form

Backup and Restore Of Database
Attach and Detach of Database
Thanks
Srinivas
 9059361460
srinivas.r.salesforce@gmail.com

Tuesday, December 23, 2014

****POC: Updating the complex View****

Is Complex views are updatable ?

yes,we can as follows :)

Generally we have two types of views are there, simple view(the view which created on single table) and complex view(the view which is created using more than one table and we can consider the view as complex view even if we create on single table if it contains(distinct,aggregate function,group by,having clauses,computed columns and set operators).

So a simple view can be updatable but a complex view can't be updatable because it contains the columns of two or more tables.

But it is not an achievable thing, we can achieve this thing by using Instead of trigger

please find the below tables.


From the above two tables I am creating a view as follows

create view emp_dept
as
select e.eno,e.ename,e.job,e.sal,d.dno,d.dname,d.loc
from employee10 e inner join department d
on e.deptno=d.dno

when ever we are trying to insert a record in the view,we got the below error



"View or function 'emp_dept' is not updatable because the modification affects multiple base tables."

So we can overcome this drawback using instead of triggers as shown in below 




Now the same insertion will success as shown below.




Now 



The new row got inserted in both of the tables.The remaining columns which are not available on view will be filled with null value.

By using this approach we can update the complex view.

Let me know if you have any queries on this.

Thanks
Srinivas
9059361460

Wednesday, December 10, 2014

Differences between and Stored Procedures and Functions

User Defined function                                              Stored Procedure
----------------------------------------------------------------------------------------------------------
Functions must return a value.                                Stored procedure may or not return values.

Functions Will allow only Select                             Procedures Can have select statements
statement,  will not allow us to                                 as well as DML statements insert,
use DML statements.                                                       update, delete.
                                                                                 
Functions will allow only input                                Procedures can have both input
parameters,doesn’t support    and output parameters.
output parameters.                      

Functions will not allow us to use                            For exception handling we can use
try-catch blocks.                                                                   try catch blocks.

Transactions are not allowed within Can use transactions within Stored
functions.                                                                              procedures.

We can use only table variables,                            Can use both table variables aswell as
it will not allow using temporary tables.                   temporary table in it.

Stored procedures can’t be called from                    Stored Procedures can call functions.
function.

Functions can be called from Procedures can’t be called from
select statement.                                                             Select/Where/Having etc statements.
                                                                                              Execute/Execstatement can be used to                                                                                                       call/execute stored procedure.

UDF can be used in join clause as a result set. Procedures can’t be used in Join clause


Thanks
srinivas