SlideShare ist ein Scribd-Unternehmen logo
Encryption Technology
Karve Nagar, Pune -52
SYLLABUS FOR MS SQL SERVER .Net by SHASHANK SIR
02065000957/8087155500
Visit us at www.encryptiontechnology.in
RDBMS BASICS: WHAT MAKES UP
A SQL SERVER DATABASE?
An Overview of Database Objects
The Database Object
The Transaction Log
The Most Basic Database Object: Table
Filegroups
Diagrams
Views
Stored Procedures
User-Defined Functions
Sequences
Users and Roles
Rules
Defaults
User-Defined Data Types
Full-Text Catalogs
SQL Server Data Types
NULL Data
SQL Server Identifiers for Objects
What Gets Named?
Rules for Naming
LEARNING THE TOOLS OF THE TRADE
Getting Help with Books Online
SQL Server Configuration Manager
Service Management
Network Configuration
The Protocols
On to the Client
SQL Server Management Studio
Getting Started with the Management
Studio
Interacting Through the Query Window
SQL Server Data Tools (formerly BIDS)
SQL Server Integration Services (SSIS)
SQL Server Reporting Services (SSRS)
SQL Server Analysis Services (SSAS)
Bulk Copy Program (BCP)
SQL Server Profiler
sqlcmd
PowerShell
THE FOUNDATION STATEMENTS OF T-SQL
Getting Started with a Basic SELECT
Statement
The SELECT Statement and FROM Clause
The WHERE Clause
ORDER BY
Aggregating Data Using the GROUP BY
Clause
Placing Conditions on Groups with the
HAVING Clause
Outputting XML Using the FOR XML Clause
Making Use of Hints Using the OPTION
Clause
The DISTINCT and ALL Predicates
Adding Data with the INSERT Statement
Multirow Inserts
The INSERT INTO . . . SELECT Statement
Changing What You’ve Got with the UPDATE
Statement
The DELETE Statement
JOINS
Combining Table Data with JOINs
Selecting Matching Rows with INNER JOIN
How an INNER JOIN Is Like a WHERE Clause
Retrieving More Data with OUTER JOIN
The Simple OUTER JOIN
Dealing with More Complex OUTER JOINs
Seeing Both Sides with FULL JOINs
Understanding CROSS JOINs
Exploring Alternative Syntax for Joins
An Alternative INNER JOIN
An Alternative OUTER JOIN
An Alternative CROSS JOIN
Stacking Results with UNION
CREATING AND ALTERING TABLES
Object Names in SQL Server
Schema Name (aka Ownership)
The Database Name
Naming by Server
Reviewing the Defaults
The CREATE Statement
CREATE DATABASE
Building a Database
CREATE TABLE
The ALTER Statement
ALTER DATABASE
ALTER TABLE
The DROP Statement
Using the GUI Tool
Creating a Database Using the
Management Studio
Backing into the Code: Creating Scripts
with the Management Studio
KEYS AND CONSTRAINTS
Types of Constraints
Domain Constraints
Entity Constraints
Referential Integrity Constraints
Constraint Naming
Key Constraints
Primary Key Constraints
Foreign Key Constraints
UNIQUE Constraints
CHECK Constraints
DEFAULT Constraints
Defining a DEFAULT Constraint in Your
CREATE TABLE Statement
Adding a DEFAULT Constraint to an
Existing Table
Disabling Constraints
Ignoring Bad Data When You Create the
Constraint
Temporarily Disabling an Existing
Constraint
Rules and Defaults — Cousins of Constraints
Rules
Dropping Rules
Defaults
Dropping Defaults
Determining Which Tables and Data Types
Use a Given Rule or Default
Triggers for Data Integrity
Choosing What to Use
ADDING MORE TO YOUR QUERIES
What Is a Subquery?
Building a Nested Subquery
Building Correlated Subqueries
How Correlated Subqueries Work
Dealing with NULL Data — the ISNULL
Function
Derived Tables
Using Common Table Expressions (CTEs)
Using the WITH Keyword
Using Multiple CTEs
Recursive CTEs
Using the EXISTS Operator
Filtering with EXISTS
Using EXISTS in Other Ways
Mixing Data Types: CAST and CONVERT
Synchronizing Data with the MERGE
Command
The Merge Command in Action
A Brief Look at BY TARGET versus BY
SOURCE
Gathering Affected Rows with the OUTPUT
Clause
Through the Looking Glass: Windowing
Functions
ROW_NUMBER
RANK, DENSE_RANK, and NTILE
One Chunk at a Time: Ad Hoc Query Paging
Performance Considerations
Measuring Performance
JOINs versus Subqueries versus CTEs
versus
BEING NORMAL: NORMALIZATION AND
OTHER BASIC DESIGN ISSUES
Understanding Tables
Keeping Your Data “Normal”
Before the Beginning
The First Normal Form
The Second Normal Form
The Third Normal Form
Other Normal Forms
Understanding Relationships
One-to-One
Zero or One-to-One
One-to-One or Many
One-to-Zero, One, or Many
Many-to-Many
Diagramming Databases
Tables
Creating Relationships in Diagrams
Denormalization
Beyond Normalization
Keep It Simple
Choosing Data Types
Err on the Side of Storing Things
Drawing Up a Quick Example
Creating the Database
Adding the Diagram and the Initial Tables
Adding the Relationships
Adding Some Constraints
SQL SERVER STORAGE AND INDEX
STRUCTURES
SQL Server Storage
The Database
The Extent
The Page
Rows
Encryption Technology
Karve Nagar, Pune -52
SYLLABUS FOR MS SQL SERVER .Net by SHASHANK SIR
02065000957/8087155500
Visit us at www.encryptiontechnology.in
Sparse Columns
Understanding Indexes
B-Trees
How Data Is Accessed in SQL Server
Creating, Altering, and Dropping Indexes
The CREATE INDEX Statement
Creating XML Indexes
Implied Indexes Created with Constraints
Creating Indexes on Sparse and Geospatial
Columns
Choosing Wisely: Deciding Which Index Goes
Where and When
Selectivity
Watching Costs: When Less Is More
Choosing That Clustered Index
Column Order Matters
Covering Indexes
Filtered Indexes
ALTER INDEX
Dropping Indexes
Taking a Hint from the Query Plan
Why Isn’t Your Index Being Used?
Use the Database Engine Tuning Advisor
Maintaining Your Indexes
Fragmentation
Identifying Fragmentation versus
Likelihood of Page Splits
VIEWS
Creating Simple Views
Views as Filters
Editing Views with T-SQL
Dropping Views
Creating and Editing Views in the
Management Studio
Creating Views in Management Studio
Editing Views in the Management Studio
Auditing: Displaying Existing Code
Protecting Code: Encrypting Views
About Schema Binding
Making Your View Look Like a Table with
VIEW_METADATA
Indexed (Materialized) Views
Indexing an Aggregate View
WRITING SCRIPTS AND BATCHES
Understanding Script Basics
Selecting a Database Context with the USE
Statement
Declaring Variables
Setting the Value in Your Variables
Reviewing System Functions
Retrieving IDENTITY Values
Generating SEQUENCES
Using @@ROWCOUNT
Grouping Statements into Batches
A Line to Itself
Each Batch Is Sent to the Server Separately
GO Is Not a T-SQL Command
Errors in Batches
When to Use Batches
Running from the Command Prompt: sqlcmd
Dynamic SQL: Using the EXEC Command
Generating Your Code on the Fly
Understanding the Dangers of Dynamic
SQL
Using Control-of-Flow Statements
The IF . . . ELSE Statement
The CASE Statement
Looping with the WHILE Statement
The WAITFOR Statement
Dealing with Errors with TRY/CATCH Blocks
STORED PROCEDURES
Creating the Sproc: Basic Syntax
An Example of a Basic Sproc
Changing Stored Procedures with ALTER
Dropping Sprocs
Parameterizing Sprocs
Declaring Parameters
Confirming Success or Failure with Return
Values
How to Use RETURN
More on Dealing with Errors
Handling Inline Errors
Making Use of @@ERROR
Using @@ERROR in a Sproc
Handling Errors Before They Happen
Manually Raising Errors
Re-throwing Errors
Adding Your Own Custom Error Messages
What a Sproc Offers
Creating Callable Processes
Using Sprocs for Security
Sprocs and Performance
Extended Stored Procedures (XPs)
A Brief Look at Recursion
Debugging
Starting the Debugger
Parts of the Debugger
Taking a Break: Breakpoints
Using the Debugger Once It’s Started
Understanding .NET Assemblies
When to Use Stored Procedures
USER-DEFINED FUNCTIONS
What a UDF Is
UDFs Returning a Scalar Value
UDFs That Return a Table
Inline UDFs
Understanding Determinism
Debugging User-Defined Functions
Using .NET in a Database World
TRANSACTIONS AND LOCKS
Understanding Transactions
ACID Transactions
Introducing Transaction Operations
Using BEGIN TRAN
Using COMMIT TRAN
Using ROLLBACK TRAN
Using SAVE TRAN
How the SQL Server Log Works
Using the Log for Failure and Recovery
Activating Implicit Transactions
Understanding Locks and Concurrency
Clarifying the Purpose of Locks
Defining Lockable Resources
Lock Escalation and Lock Effects on
Performance
Understanding Lock Modes
Clarifying Lock Compatibility
Specifying a Specific Lock Type — Optimizer
Hints
Setting the Isolation Level
Setting READ COMMITTED
Setting READ UNCOMMITTED
Setting REPEATABLE READ
Setting SERIALIZABLE
Setting SNAPSHOT
Dealing with Deadlocks (aka “a 1205”)
How SQL Server Figures Out There’s a
Deadlock
How Deadlock Victims Are Chosen
Avoiding Deadlocks
TRIGGERS
What Is a Trigger?
ON
WITH ENCRYPTION
FOR|AFTER
The FOR|AFTER versus the INSTEAD OF
Clause
NOT FOR REPLICATION
AS
Using Triggers for Data Integrity Rules
Dealing with Requirements Sourced from
Other Tables
Using Triggers to Check the Delta of an
Update
Using Triggers for Custom Error Messages
Other Common Uses for Triggers
Other Trigger Issues
Triggers Can Be Nested
Triggers Can Be Recursive
Triggers Don’t Prevent Architectural
Changes
Triggers Can Be Turned Off without Being
Removed
Trigger Firing Order
INSTEAD OF Triggers
Performance Considerations
Triggers Are Reactive Rather Than
Proactive
Triggers Don’t Have Concurrency Issues
with the Process
that Fires them
Using IF UPDATE() and
COLUMNS_UPDATED
Keep It Short and Sweet
Don’t Forget Triggers When Choosing
Indexes
Try Not to Roll Back within Triggers
Dropping Triggers
Debugging Triggers
FOR MORE
INFORMATION
JUST CALL ON
02065000957
8087155500
www.encryptiontecnology.in

Weitere ähnliche Inhalte

Was ist angesagt?

Microsoft SQL Azure - Building Applications Using SQL Azure Presentation
Microsoft SQL Azure - Building Applications Using SQL Azure PresentationMicrosoft SQL Azure - Building Applications Using SQL Azure Presentation
Microsoft SQL Azure - Building Applications Using SQL Azure Presentation
Microsoft Private Cloud
 
Creating Flexible Data Services For Enterprise Soa With Wso2 Data Services
Creating Flexible Data Services For Enterprise Soa With Wso2 Data ServicesCreating Flexible Data Services For Enterprise Soa With Wso2 Data Services
Creating Flexible Data Services For Enterprise Soa With Wso2 Data Services
sumedha.r
 
Microsoft SQL Server 2008
Microsoft SQL Server 2008Microsoft SQL Server 2008
Microsoft SQL Server 2008
Hossein Zahed
 
Using hash fields in sql server tech republic
Using hash fields in sql server   tech republicUsing hash fields in sql server   tech republic
Using hash fields in sql server tech republic
Kaing Menglieng
 

Was ist angesagt? (20)

KoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloud
KoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloudKoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloud
KoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloud
 
Azure Active Directory Connect: Technical Deep Dive - EU Collab Summit 2018
Azure Active Directory Connect: Technical Deep Dive - EU Collab Summit 2018Azure Active Directory Connect: Technical Deep Dive - EU Collab Summit 2018
Azure Active Directory Connect: Technical Deep Dive - EU Collab Summit 2018
 
SPS Lisbon 2018 - Azure AD Connect Technical Deep Dive
SPS Lisbon 2018 - Azure AD Connect Technical Deep DiveSPS Lisbon 2018 - Azure AD Connect Technical Deep Dive
SPS Lisbon 2018 - Azure AD Connect Technical Deep Dive
 
Azure Active Directory Connect: Technical Deep Dive - DWCAU 2018 Melbourne
Azure Active Directory Connect: Technical Deep Dive - DWCAU 2018 MelbourneAzure Active Directory Connect: Technical Deep Dive - DWCAU 2018 Melbourne
Azure Active Directory Connect: Technical Deep Dive - DWCAU 2018 Melbourne
 
Microsoft SQL Azure - Building Applications Using SQL Azure Presentation
Microsoft SQL Azure - Building Applications Using SQL Azure PresentationMicrosoft SQL Azure - Building Applications Using SQL Azure Presentation
Microsoft SQL Azure - Building Applications Using SQL Azure Presentation
 
Oracle training-institutes-in-hyderabad
Oracle training-institutes-in-hyderabadOracle training-institutes-in-hyderabad
Oracle training-institutes-in-hyderabad
 
Creating Flexible Data Services For Enterprise Soa With Wso2 Data Services
Creating Flexible Data Services For Enterprise Soa With Wso2 Data ServicesCreating Flexible Data Services For Enterprise Soa With Wso2 Data Services
Creating Flexible Data Services For Enterprise Soa With Wso2 Data Services
 
Breaking Down the Tools and Features in Office 365 - EU Collab Summit 2018
Breaking Down the Tools and Features in Office 365 - EU Collab Summit 2018Breaking Down the Tools and Features in Office 365 - EU Collab Summit 2018
Breaking Down the Tools and Features in Office 365 - EU Collab Summit 2018
 
Microsoft/Zend Webcast on Cloud Computing
Microsoft/Zend Webcast on Cloud ComputingMicrosoft/Zend Webcast on Cloud Computing
Microsoft/Zend Webcast on Cloud Computing
 
Office 365 Identity Management - SMBNation 2015
Office 365 Identity Management - SMBNation 2015Office 365 Identity Management - SMBNation 2015
Office 365 Identity Management - SMBNation 2015
 
Real World Experience: Integrating DB2 with XPages
Real World Experience: Integrating DB2 with XPagesReal World Experience: Integrating DB2 with XPages
Real World Experience: Integrating DB2 with XPages
 
Writing simple web services in java using eclipse editor
Writing simple web services in java using eclipse editorWriting simple web services in java using eclipse editor
Writing simple web services in java using eclipse editor
 
Office 365 busting the myths
Office 365 busting the mythsOffice 365 busting the myths
Office 365 busting the myths
 
Advanced SharePoint Web Part Development
Advanced SharePoint Web Part DevelopmentAdvanced SharePoint Web Part Development
Advanced SharePoint Web Part Development
 
Spring Test DBUnit
Spring Test DBUnitSpring Test DBUnit
Spring Test DBUnit
 
Microsoft SQL Server 2008
Microsoft SQL Server 2008Microsoft SQL Server 2008
Microsoft SQL Server 2008
 
ASP.NET Lecture 4
ASP.NET Lecture 4ASP.NET Lecture 4
ASP.NET Lecture 4
 
Hibernate
HibernateHibernate
Hibernate
 
Toad tipstricksexpertinsight
Toad tipstricksexpertinsightToad tipstricksexpertinsight
Toad tipstricksexpertinsight
 
Using hash fields in sql server tech republic
Using hash fields in sql server   tech republicUsing hash fields in sql server   tech republic
Using hash fields in sql server tech republic
 

Ähnlich wie FREE Sql Server syllabus

Introduction to Threading in .Net
Introduction to Threading in .NetIntroduction to Threading in .Net
Introduction to Threading in .Net
webhostingguy
 
1 extreme performance - part i
1   extreme performance - part i1   extreme performance - part i
1 extreme performance - part i
sqlserver.co.il
 
SQLCLR For DBAs and Developers
SQLCLR For DBAs and DevelopersSQLCLR For DBAs and Developers
SQLCLR For DBAs and Developers
webhostingguy
 
Dr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. HydeDr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. Hyde
webhostingguy
 

Ähnlich wie FREE Sql Server syllabus (20)

SQLSaturday#290_Kiev_WindowsAzureDatabaseForBeginners
SQLSaturday#290_Kiev_WindowsAzureDatabaseForBeginnersSQLSaturday#290_Kiev_WindowsAzureDatabaseForBeginners
SQLSaturday#290_Kiev_WindowsAzureDatabaseForBeginners
 
SQL Server - High availability
SQL Server - High availabilitySQL Server - High availability
SQL Server - High availability
 
Oracle 11g developer on linux training in bangalore
Oracle 11g developer on linux training in bangaloreOracle 11g developer on linux training in bangalore
Oracle 11g developer on linux training in bangalore
 
Oracle 11g developer on linux training in bangalore
Oracle 11g developer on linux training in bangaloreOracle 11g developer on linux training in bangalore
Oracle 11g developer on linux training in bangalore
 
Introduction to Threading in .Net
Introduction to Threading in .NetIntroduction to Threading in .Net
Introduction to Threading in .Net
 
Session 2: SQL Server 2012 with Christian Malbeuf
Session 2: SQL Server 2012 with Christian MalbeufSession 2: SQL Server 2012 with Christian Malbeuf
Session 2: SQL Server 2012 with Christian Malbeuf
 
Winter course
Winter courseWinter course
Winter course
 
1 extreme performance - part i
1   extreme performance - part i1   extreme performance - part i
1 extreme performance - part i
 
Novidades do SQL Server 2016
Novidades do SQL Server 2016Novidades do SQL Server 2016
Novidades do SQL Server 2016
 
Azure - Data Platform
Azure - Data PlatformAzure - Data Platform
Azure - Data Platform
 
Sql server
Sql serverSql server
Sql server
 
Summary python coding
Summary python codingSummary python coding
Summary python coding
 
Sql server basics
Sql server basicsSql server basics
Sql server basics
 
Day Of Cloud - Windows Azure Platform
Day Of Cloud - Windows Azure PlatformDay Of Cloud - Windows Azure Platform
Day Of Cloud - Windows Azure Platform
 
A Primer To Sybase Iq Development July 13
A Primer To Sybase Iq Development July 13A Primer To Sybase Iq Development July 13
A Primer To Sybase Iq Development July 13
 
Microsoft SQL Server 2012
Microsoft SQL Server 2012 Microsoft SQL Server 2012
Microsoft SQL Server 2012
 
Dot net training bangalore
Dot net training bangaloreDot net training bangalore
Dot net training bangalore
 
SQLCLR For DBAs and Developers
SQLCLR For DBAs and DevelopersSQLCLR For DBAs and Developers
SQLCLR For DBAs and Developers
 
Dr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. HydeDr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. Hyde
 
Day2
Day2Day2
Day2
 

Kürzlich hochgeladen

Laundry management system project report.pdf
Laundry management system project report.pdfLaundry management system project report.pdf
Laundry management system project report.pdf
Kamal Acharya
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
Kamal Acharya
 
Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdf
Kamal Acharya
 
Hall booking system project report .pdf
Hall booking system project report  .pdfHall booking system project report  .pdf
Hall booking system project report .pdf
Kamal Acharya
 

Kürzlich hochgeladen (20)

weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
 
Laundry management system project report.pdf
Laundry management system project report.pdfLaundry management system project report.pdf
Laundry management system project report.pdf
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
 
Natalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in KrakówNatalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in Kraków
 
Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdf
 
The Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docx
The Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docxThe Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docx
The Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docx
 
Online resume builder management system project report.pdf
Online resume builder management system project report.pdfOnline resume builder management system project report.pdf
Online resume builder management system project report.pdf
 
fluid mechanics gate notes . gate all pyqs answer
fluid mechanics gate notes . gate all pyqs answerfluid mechanics gate notes . gate all pyqs answer
fluid mechanics gate notes . gate all pyqs answer
 
fundamentals of drawing and isometric and orthographic projection
fundamentals of drawing and isometric and orthographic projectionfundamentals of drawing and isometric and orthographic projection
fundamentals of drawing and isometric and orthographic projection
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES  INTRODUCTION UNIT-IENERGY STORAGE DEVICES  INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
A case study of cinema management system project report..pdf
A case study of cinema management system project report..pdfA case study of cinema management system project report..pdf
A case study of cinema management system project report..pdf
 
Hall booking system project report .pdf
Hall booking system project report  .pdfHall booking system project report  .pdf
Hall booking system project report .pdf
 

FREE Sql Server syllabus

  • 1. Encryption Technology Karve Nagar, Pune -52 SYLLABUS FOR MS SQL SERVER .Net by SHASHANK SIR 02065000957/8087155500 Visit us at www.encryptiontechnology.in RDBMS BASICS: WHAT MAKES UP A SQL SERVER DATABASE? An Overview of Database Objects The Database Object The Transaction Log The Most Basic Database Object: Table Filegroups Diagrams Views Stored Procedures User-Defined Functions Sequences Users and Roles Rules Defaults User-Defined Data Types Full-Text Catalogs SQL Server Data Types NULL Data SQL Server Identifiers for Objects What Gets Named? Rules for Naming LEARNING THE TOOLS OF THE TRADE Getting Help with Books Online SQL Server Configuration Manager Service Management Network Configuration The Protocols On to the Client SQL Server Management Studio Getting Started with the Management Studio Interacting Through the Query Window SQL Server Data Tools (formerly BIDS) SQL Server Integration Services (SSIS) SQL Server Reporting Services (SSRS) SQL Server Analysis Services (SSAS) Bulk Copy Program (BCP) SQL Server Profiler sqlcmd PowerShell THE FOUNDATION STATEMENTS OF T-SQL Getting Started with a Basic SELECT Statement The SELECT Statement and FROM Clause The WHERE Clause ORDER BY Aggregating Data Using the GROUP BY Clause Placing Conditions on Groups with the HAVING Clause Outputting XML Using the FOR XML Clause Making Use of Hints Using the OPTION Clause The DISTINCT and ALL Predicates Adding Data with the INSERT Statement Multirow Inserts The INSERT INTO . . . SELECT Statement Changing What You’ve Got with the UPDATE Statement The DELETE Statement JOINS Combining Table Data with JOINs Selecting Matching Rows with INNER JOIN How an INNER JOIN Is Like a WHERE Clause Retrieving More Data with OUTER JOIN The Simple OUTER JOIN Dealing with More Complex OUTER JOINs Seeing Both Sides with FULL JOINs Understanding CROSS JOINs Exploring Alternative Syntax for Joins An Alternative INNER JOIN An Alternative OUTER JOIN An Alternative CROSS JOIN Stacking Results with UNION CREATING AND ALTERING TABLES Object Names in SQL Server Schema Name (aka Ownership) The Database Name Naming by Server Reviewing the Defaults The CREATE Statement CREATE DATABASE Building a Database CREATE TABLE The ALTER Statement ALTER DATABASE ALTER TABLE The DROP Statement Using the GUI Tool Creating a Database Using the Management Studio Backing into the Code: Creating Scripts with the Management Studio KEYS AND CONSTRAINTS Types of Constraints Domain Constraints Entity Constraints Referential Integrity Constraints Constraint Naming Key Constraints Primary Key Constraints Foreign Key Constraints UNIQUE Constraints CHECK Constraints DEFAULT Constraints Defining a DEFAULT Constraint in Your CREATE TABLE Statement Adding a DEFAULT Constraint to an Existing Table Disabling Constraints Ignoring Bad Data When You Create the Constraint Temporarily Disabling an Existing Constraint Rules and Defaults — Cousins of Constraints Rules Dropping Rules Defaults Dropping Defaults Determining Which Tables and Data Types Use a Given Rule or Default Triggers for Data Integrity Choosing What to Use ADDING MORE TO YOUR QUERIES What Is a Subquery? Building a Nested Subquery Building Correlated Subqueries How Correlated Subqueries Work Dealing with NULL Data — the ISNULL Function Derived Tables Using Common Table Expressions (CTEs) Using the WITH Keyword Using Multiple CTEs Recursive CTEs Using the EXISTS Operator Filtering with EXISTS Using EXISTS in Other Ways Mixing Data Types: CAST and CONVERT Synchronizing Data with the MERGE Command The Merge Command in Action A Brief Look at BY TARGET versus BY SOURCE Gathering Affected Rows with the OUTPUT Clause Through the Looking Glass: Windowing Functions ROW_NUMBER RANK, DENSE_RANK, and NTILE One Chunk at a Time: Ad Hoc Query Paging Performance Considerations Measuring Performance JOINs versus Subqueries versus CTEs versus BEING NORMAL: NORMALIZATION AND OTHER BASIC DESIGN ISSUES Understanding Tables Keeping Your Data “Normal” Before the Beginning The First Normal Form The Second Normal Form The Third Normal Form Other Normal Forms Understanding Relationships One-to-One Zero or One-to-One One-to-One or Many One-to-Zero, One, or Many Many-to-Many Diagramming Databases Tables Creating Relationships in Diagrams Denormalization Beyond Normalization Keep It Simple Choosing Data Types Err on the Side of Storing Things Drawing Up a Quick Example Creating the Database Adding the Diagram and the Initial Tables Adding the Relationships Adding Some Constraints SQL SERVER STORAGE AND INDEX STRUCTURES SQL Server Storage The Database The Extent The Page Rows
  • 2. Encryption Technology Karve Nagar, Pune -52 SYLLABUS FOR MS SQL SERVER .Net by SHASHANK SIR 02065000957/8087155500 Visit us at www.encryptiontechnology.in Sparse Columns Understanding Indexes B-Trees How Data Is Accessed in SQL Server Creating, Altering, and Dropping Indexes The CREATE INDEX Statement Creating XML Indexes Implied Indexes Created with Constraints Creating Indexes on Sparse and Geospatial Columns Choosing Wisely: Deciding Which Index Goes Where and When Selectivity Watching Costs: When Less Is More Choosing That Clustered Index Column Order Matters Covering Indexes Filtered Indexes ALTER INDEX Dropping Indexes Taking a Hint from the Query Plan Why Isn’t Your Index Being Used? Use the Database Engine Tuning Advisor Maintaining Your Indexes Fragmentation Identifying Fragmentation versus Likelihood of Page Splits VIEWS Creating Simple Views Views as Filters Editing Views with T-SQL Dropping Views Creating and Editing Views in the Management Studio Creating Views in Management Studio Editing Views in the Management Studio Auditing: Displaying Existing Code Protecting Code: Encrypting Views About Schema Binding Making Your View Look Like a Table with VIEW_METADATA Indexed (Materialized) Views Indexing an Aggregate View WRITING SCRIPTS AND BATCHES Understanding Script Basics Selecting a Database Context with the USE Statement Declaring Variables Setting the Value in Your Variables Reviewing System Functions Retrieving IDENTITY Values Generating SEQUENCES Using @@ROWCOUNT Grouping Statements into Batches A Line to Itself Each Batch Is Sent to the Server Separately GO Is Not a T-SQL Command Errors in Batches When to Use Batches Running from the Command Prompt: sqlcmd Dynamic SQL: Using the EXEC Command Generating Your Code on the Fly Understanding the Dangers of Dynamic SQL Using Control-of-Flow Statements The IF . . . ELSE Statement The CASE Statement Looping with the WHILE Statement The WAITFOR Statement Dealing with Errors with TRY/CATCH Blocks STORED PROCEDURES Creating the Sproc: Basic Syntax An Example of a Basic Sproc Changing Stored Procedures with ALTER Dropping Sprocs Parameterizing Sprocs Declaring Parameters Confirming Success or Failure with Return Values How to Use RETURN More on Dealing with Errors Handling Inline Errors Making Use of @@ERROR Using @@ERROR in a Sproc Handling Errors Before They Happen Manually Raising Errors Re-throwing Errors Adding Your Own Custom Error Messages What a Sproc Offers Creating Callable Processes Using Sprocs for Security Sprocs and Performance Extended Stored Procedures (XPs) A Brief Look at Recursion Debugging Starting the Debugger Parts of the Debugger Taking a Break: Breakpoints Using the Debugger Once It’s Started Understanding .NET Assemblies When to Use Stored Procedures USER-DEFINED FUNCTIONS What a UDF Is UDFs Returning a Scalar Value UDFs That Return a Table Inline UDFs Understanding Determinism Debugging User-Defined Functions Using .NET in a Database World TRANSACTIONS AND LOCKS Understanding Transactions ACID Transactions Introducing Transaction Operations Using BEGIN TRAN Using COMMIT TRAN Using ROLLBACK TRAN Using SAVE TRAN How the SQL Server Log Works Using the Log for Failure and Recovery Activating Implicit Transactions Understanding Locks and Concurrency Clarifying the Purpose of Locks Defining Lockable Resources Lock Escalation and Lock Effects on Performance Understanding Lock Modes Clarifying Lock Compatibility Specifying a Specific Lock Type — Optimizer Hints Setting the Isolation Level Setting READ COMMITTED Setting READ UNCOMMITTED Setting REPEATABLE READ Setting SERIALIZABLE Setting SNAPSHOT Dealing with Deadlocks (aka “a 1205”) How SQL Server Figures Out There’s a Deadlock How Deadlock Victims Are Chosen Avoiding Deadlocks TRIGGERS What Is a Trigger? ON WITH ENCRYPTION FOR|AFTER The FOR|AFTER versus the INSTEAD OF Clause NOT FOR REPLICATION AS Using Triggers for Data Integrity Rules Dealing with Requirements Sourced from Other Tables Using Triggers to Check the Delta of an Update Using Triggers for Custom Error Messages Other Common Uses for Triggers Other Trigger Issues Triggers Can Be Nested Triggers Can Be Recursive Triggers Don’t Prevent Architectural Changes Triggers Can Be Turned Off without Being Removed Trigger Firing Order INSTEAD OF Triggers Performance Considerations Triggers Are Reactive Rather Than Proactive Triggers Don’t Have Concurrency Issues with the Process that Fires them Using IF UPDATE() and COLUMNS_UPDATED Keep It Short and Sweet Don’t Forget Triggers When Choosing Indexes Try Not to Roll Back within Triggers Dropping Triggers Debugging Triggers FOR MORE INFORMATION JUST CALL ON 02065000957 8087155500 www.encryptiontecnology.in