DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

27
Copyright © Genetic Computer School 2009 DBSQL 14-1 Chapter 14 Microsoft SQL Server

Transcript of DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Page 1: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School 2009DBSQL 14-1

Chapter 14

Microsoft SQL Server

Page 2: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-2

Chapter 14 OverviewManagement, Design and Querying ToolsSQL Variation and ExtensionDefining an Index in SQL ServerConcurrency and Data AccessQuery Processing and OptimizationReplicationXML Support in SQL Server 2005Event Notification Services and SQL Server Service BrokerBusiness Intelligence and Data Warehousing

Page 3: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-3

Management, Design and Querying Tools

SQL Server Management Studio is an integrated environment for

accessing, configuring, managing, administering, and developing all components of SQL Server

combines a broad group of graphical tools with a number of rich script editors to provide access to SQL Server to developers and administrators of all skill levels

Page 4: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-4

Cont’

SQL Server Tools Object Browser Registered Servers Solution Explorer Management Studio Template

Page 5: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-5

SQL Variations and Extensions

Create Triggers Using T-SQL Example:

Page 6: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-6

Defining an Index in SQL Server

When data volumes increases, organizations are faced with problems relating to data retrieval and posting. They feel the need for a way to increase the speed of data access. An index, enables database retrieve and present data to the end user with ease. An index can be defined as a mechanism for providing fast access to table rows and for enforcing constraints

Page 7: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-7

Cont’

Types of index Clustered Non-clustered

The Query Optimizer uses indexes to reduce disk I/O operations and use of system resources while querying on data. Queries which contain SELECT, UPDATE or DELETE statement require indexes for optimal performance. When a query is executed, each available methods is evaluated for retrieving data and the most efficient one is selected by the Query optimizer. The methodology used may be table scans or index scans.

Page 8: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-8

Cont’ To Create an index:

Page 9: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-9

Concurrency and Data Access

Concurrency is the ability of multiple users to access data at the same time. When the number of simultaneous operations that the database engine can support is large, the database concurrency is increased. In Microsoft SQL Server 2005 Compact Edition (SQL Server Compact Edition), concurrency control is achieved by using locks to help protect data.

Page 10: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-10

Query Processing and Optimization

When the application queries the database system, it is first parsed by the SQL Parser sub-component which verifies the syntax and converts the query into a relational algebraic expression (the internal representation) Then Another sub-component named Query Optimizer constructs a query execution plan based on several rules and the cost of executing the query The cost is calculated based upon the DBMS-maintained statistics for each joined table in the query. Because the plan is typically large, the Query Optimizer often evaluates only a subset and assumes that the cost of the subset is representative of the whole

Page 11: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-11

Cont’

Analyzing an Execution Plan In order to analyze an execution plan

in SQL Server, we can take advantage of the Display Execution Plan and Display Estimated Execution Plan features in Management Studio by using some SET options such as SHOWPLAN_XML and SHOWPLAN_ALL

Page 12: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-12

Cont’

Optimizing SELECT statements

Page 13: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-13

Replication

SQL Server Management Studio provides the Replication folder as a central location to organize and administer your publications and subscriptions. If you have heterogeneous publishing services from Microsoft or other companies installed, the Heterogeneous Replication folder will appear under the Replication folder as a location to manage publications and subscriptions based on heterogeneous data sources.

Page 14: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-14

Cont’

Page 15: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-15

Cont’

Replication Monitor Through Replication Monitor, you can

view and manage replication agents responsible for various replication tasks.

Replication Monitor appears as a node below the Replication folder in SQL Server Management Studio on the Distributor after you have configured publishing and distribution

Page 16: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-16

Cont’

Page 17: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-17

XML Support in SQL Server 2005

SQL Server 2005 provides extensive support for XML data processing. XML values can be stored natively in an xml data type column that can be typed according to a collection of XML schemas, or left un-typed. We can index the XML column. Additionally, fine-grained data manipulation is supported by using XQuery and XML DML. XML DML is an extension for data modification.

Page 18: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-18

Cont’

Uses of XML data type in SQL Server As a column in a table As a variable in Transact-SQL As a stored procedure or user-defined

functions As a user-defined return value

Page 19: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-19

Cont’

Example of XML as a column in a table:

create table xmlsample( xmlID varchar(05) not null primary key, xmlnum int , xmlDt xml);

or

Page 20: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-20

Event Notification and Server Service Broker

SQL Server Notification Service

executable process and a framework for building a specific type of applications, notification applications.

Like SQL Server’s Analysis Services and Service Broker, it extends the application coding reach and moves SQL Server and related service toward being an integrated platform for scalable application systems.

Page 21: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-21

Cont’

Page 22: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-22

Cont’

Some Parts of Notification Services

Page 23: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-23

Cont’

Server Service Broker a new part of the database engine that is used to

build reliable, asynchronous, message-based distributed database applications.

Service Broker allows these applications to concentrate their development efforts on the issues of the problem domain in which they are going to be used.

The SQL Server Service Broker is a technology for building message-based, asynchronous, loosely coupled database application.

Service Broker makes it possible for applications to send and receive ordered, reliable, asynchronous messages

Page 24: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-24

Cont’

Simple message based System

Page 25: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-25

Business Intelligence and Data Warehousing

In any organization it needs more than just data and information. Business Intelligence is an answer to it. It provides knowledge about your customer, competitors, business partners and competitive environment specially the internal operations of the organization. Business intelligence enables an organization to extract the true meaning of information so that you can take creative and power steps to ensure a competitive advantage Technology such as databases, database management systems, data warehouses and data- mining tools an definitely help us build and use business intelligence

Page 26: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-26

Cont’

Building Business Intelligence

Page 27: DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.

Copyright © Genetic Computer School, Singapore 2009

DBSQL 14-27

End