Tải bản đầy đủ (.pdf) (24 trang)

Overview of SQL Server 2005 pptx

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (412.98 KB, 24 trang )

Overview of SQL
Server 2005
Chapter 1
In today's competitive environment, an organization
needs a comprehensive, secure, reliable, and
productive data platform for its business
applications. The SQL Server 2005 database engine
provides a platform that allows building and
managing data applications. In addition, SQL Server
2005 combines data analysis, reporting, integration,
and notification services to enable organizations to
build and deploy efficient Business Intelligence (BI)
solutions.
This chapter discusses the importance of a database
server. In addition, it provides an overview of SQL
Server 2005, its components, and features. The
chapter introduces the Structured Query Language
(SQL) that is used to manipulate data in a database
server. Lastly, it discusses the tools provided by
SQL Server 2005 to improve the productivity of the
database developer and manage the server.
In this chapter, you will learn to:
 Appreciate SQL Server 2005 as a database
server
 Identify the SQL Server 2005 tools
Objectives

¤NIIT Overview of SQL Server 2005 1.3
Every organization needs to maintain information related to employees, customers,
business partners, or business transactions. Organizations build business applications with
a user-friendly interface to store and manipulate this information and to generate reports.


In addition, they need a platform that can be used to store and maintain this information in
an efficient way. Various database management system (DBMS) and relational database
management system (RDBMS), such as SQL Server 2005, Oracle, and Sybase, can be
used to maintain this information.
SQL Server 2005 is a data engine introduced by Microsoft. It lies at the core of the data
management solution of an organization. It allows secure and efficient storage and
management of data. In addition, SQL Server 2005 provides other components and
services that support the business intelligence platform to generate reports and facilitate
data analysis.
As a database developer, it is important for you to identify the role of a database server in
an organization. To effectively design and implement database solutions by using SQL
Server 2005, it is important for you to identify its components and services. In addition,
you need to understand the basics of SQL, a language that is used to query and manage
data.
Organizations have always been storing and managing business data. Earlier,
organizations used to store the data on paper. With an increase in the usage of computers,
organizations began building and using business applications to support the business
operations.
The business applications accept data as input, process the data based on business
requirements, and provide data or information as output. For example, an application that
maintains the sales details for an organization, accepts the details of the sales transaction
from the users. The data is saved and an output message confirming that the data has been
saved is displayed to the user.
For example, the Human Resource department of an organization uses an application to
manage the employee data. The users need to add the details of new employees. For this,
the application provides an interface to enter the employee details. These details are
validated for accuracy based on business rules. For example, a business rule is defined to
check that the date of joining of the new employee is less than or equal to the current date.
If the data meets the requirements, it is saved in the data store.
Introduction to SQL Server 2005

Role of a Database Server
1.4 Overview of SQL Server 2005 ¤NIIT
Based on the preceding scenario, a business application can have three elements:
 The user interface or the presentation element, through which data is input.
 The application logic or the business rule element, which helps in implementing the
operations to be performed on the input data.
 The data storage or the data management element, which manages the storage and
retrieval of data.
These elements form the base of the models or architectures used in application
development. Depending on the placement of these elements, the application architectures
can be categorized as:
 Single-tier architecture
 Two-tier architecture
 Three-tier architecture
 N-tier architecture
Single-Tier Architecture
In single-tier architecture, all elements of a business application are combined as a single
executable unit. This executable unit is installed on all the computers that the users need
to work on. In this case, it becomes complicated to modify the application or to fix any
bugs. This is because, after modifying the application, it is required to recompile and
redistribute the entire application to all the computers.
Two-Tier Architecture
To address the problems in modifying an application faced in a single-tier application,
two-tier architecture was evolved. In two-tier architecture, the application is divided into
two manageable parts; one part handles the data, while the other provides the user
interface. Therefore, this architecture is called two-tier architecture. The two parts can be
located on a single computer or on separate computers over a network.
¤NIIT Overview of SQL Server 2005 1.5
The part that handles the user interface (UI) is called the client tier. The part that
implements the application logic and manages the input data based on the business rules is

called the server tier, as shown in the following figure.
A Two-Tier Architecture
In this architecture, the maintenance, upgrade, and general administration of data is easier,
as it exists only on the server and not on all the clients.
Two-tier architecture is also called client-server architecture. Most RDBMSs, such as
Microsoft Access, SQL Server, and Oracle, adhere to the client-server architecture.
RDBMS provides centralized functionality required while supporting many users.
Three-Tier Architecture
When implementing complex business solutions in case of a two-tier architecture, the tier
on which the business logic is implemented becomes over loaded. As a result, it takes
more time to execute. Therefore, to provide further flexibility, the two-tier architecture
can be split into three tiers. In three-tier architecture, the first tier is the client tier, the
second or middle tier is called the business tier, and the third tier is called the server tier.
The server tier contains a database server that manages the data.
1.6 Overview of SQL Server 2005 ¤NIIT
In this architecture, an additional tier called a business tier has been added between the
client tier and the server tier of the two-tier architecture, as shown in the following figure.
A Three-Tier Client/Server Architecture
The business tier consists of all the business rules. It consists of the application logic that
implements rules and checks the data. The advantage of a three-tier application is that it
allows you to change the business rules without affecting the other two tiers.
For instance, in a banking application for loans, the user tier is the front-end used by the
customer to specify the loan details. The server tier can consist of an RDBMS in which
the data is stored. The business tier lies between the other two tiers and consists of
business rules, such as the loan limit and the interest rate charged to a customer. If there is
a change in the rate of interest, only the middle tier component needs to be modified.
N-Tier Architecture
As the business complexities increased, the business tier became larger and
unmanageable. This led to the evolution of n-tier architecture, where the business services
model was divided into smaller manageable units. N-tier architecture is also called as

multi-tier architecture.
In this architecture, it is possible to keep the UI-centric processing on a computer near the
client. In addition, you may keep the data-centric processing components on another
computer near the database server, so that you gain significant performance benefits.
¤NIIT Overview of SQL Server 2005 1.7
The N-tier architecture consists of the following layers:
 Client tier
 UI-centric processing components
 Data-centric processing objects
 Database server
The banking application, when further expanded, can depict an example of n-tier
architecture. The client tier would deal with the user interface, which would include the
user interface controls, such as forms, menus, and toolbars. The server tier would
comprise data-handling including saving data to the database server.
The business logic would include the rules and guidelines for different types of accounts,
interest rates, fixed deposits, ATMs, and overdrafts. All these would form the middle tier.
However, there would be some rules that need to be implemented on the user interface
and on the database. You can place these rules either on the UI-centric processing
components or data-centric processing components, based on the functionality.
Applications that follow multi-tier architecture can be used across various locations. For
example, in Web applications, the application is stored on the Web server. The clients
access the application from any location through a browser software. The clients make
requests and receive responses from the Web server.
1.8 Overview of SQL Server 2005 ¤NIIT
N
ote
The Web server transfers the request for data to a database server, as shown in the
following figure.
Architecture of Web Applications
Depending on the relevance of the business rules, they can be implemented on any of the

tiers, such as the Web clients, Web server, or the database server.
To provide support to applications where users can send requests simultaneously, the
database server needs to be a fast, reliable, and secure. SQL Server 2005 is one such
comprehensive database platform that provides a fast, reliable, and secure RDBMS. It also
helps in data analysis with integrated BI tools.
A BI application is an application that is used by the top management of an
organization for data analysis to make future decisions. BI tools are the tools that help
in creating reports that enable data analysis.
¤NIIT Overview of SQL Server 2005 1.9
SQL Server 2005 contains a number of components. Each component provides specific
services and support to the clients connected to the server.
The following figure depicts the components of SQL Server 2005.
Components of SQL Server 2005
As shown in the preceding figure, SQL Server 2005 consists of the following core
components:
 Database Engine
 Integration Services
 Analysis Services
 Reporting Services
Database Engine
The database engine provides support to store, query, process, and secure data on the
database server. The database engine contains databases and database objects, such as
tables and procedures. This database engine allows you to create and manage database
objects.
Apart from providing support for data management, the database engine also provides the
following background services:
 Service Broker: Provides support for asynchronous communication between clients
and the database server, enabling reliable query processing. The client application
sends a request to the database server and continues to work. The requests sent by the
client are queued up at the server, in case the server is not available to process the

request immediately. Server Broker ensures that the request is processed whenever
the server is available.
SQL Server 2005 Components
1.10 Overview of SQL Server 2005 ¤NIIT

Replication: Allows you to copy and distribute data and database objects from one
database server to another. These servers can be located at remote locations to
provide fast access to users at widely distributed locations. After replicating data, the
SQL Server allows you to synchronize different databases to maintain data
consistency. For example, the database servers for your organization might be
located at different locations around the world. All the servers store common data. To
ensure that the data in all the servers is synchronous, you can implement data
replication.
 Full-text search: Allows you to implement fast and intelligent search in large
databases by allowing you to search records containing certain words and phrases.
You can search for different forms of a specific word, such as ‘produce’, ‘produces’,
or ‘production’. In addition, you can search for synonyms of a given word, such as
‘garment’, ‘cloth’, or ‘fabric’.
 Notification services: Allows you to generate and send notification messages to the
users or administrators about any event. For example, the database administrator
should be notified when a database object, such as a table is created or deleted. The
notification messages can be sent to a variety of devices, such as computers or
mobile devices.
Integration Services
Integration services allow you to gather and integrate data from various disparate data
sources available in an organization. You can store the data in a consistent format in a
common database called the data warehouse. For example, data in your organization
might be stored in different databases, such as Microsoft Access, FoxPro, or text files.
You might need to consolidate data from all these sources and save the data in a common
set of tables on a database server.

Integrating data from different sources that might be stored in different formats and
structures involves various complex operations to resolve data quality issues and convert
the data into a common format. The integration services provide a set of tasks that help
the developer create data integration projects with minimum lines of code. Data
integration allows collation of data from all the data sources in a common format to
enable accurate analysis of data.
Analysis Services
Analysis services help in data analysis in a BI application. These applications are built on
a data warehouse that contains data consolidated from various data sources. These
services provide data mining solutions that are built on data integrated in the data
warehouse. Data mining solutions allow the users to query and present data in reports that
enable business forecasts, such as expected sales or profit estimates in the next financial
year.
¤NIIT Overview of SQL Server 2005 1.11
Reporting Services
Reporting services provide support to generate comprehensive reports on data in the
database engine or in the data warehouse. These services provide a set of tools that help in
creating and managing different types of reports in different formats. Using these services,
you can create centralized reports that can be saved to a common server and provide
secure and restricted access to these reports.
SQL Server Integration with the .NET Framework
As against the earlier versions of the SQL Server, Microsoft SQL Server 2005 is
integrated with the .NET Framework, as shown in the following figure.
Integration of SQL Server 2005 with the .NET Framework
The .NET Framework is a collection of services and classes and exists as a layer between
the .NET applications and the underlying operating system. SQL Server 2005 uses various
services provided by the .NET Framework. For example, the notification services
component is based on the .NET Framework and uses its services to generate and send
notification messages.
Another advantage of the .NET integration is that you can create managed database

objects. Managed database objects are created by using any .NET language and can be
embedded within the SQL Server. For example, developers can create an object that
retrieves data from a Web server and saves it in a database table. This provides the
software developer with a flexibility of writing codes in a language the developer is most
comfortable with. Therefore, as a database developer, it is important for you to understand
the .NET Framework.
1.12 Overview of SQL Server 2005 ¤NIIT
N
ote
Just a minute:
Just a minute:
You will learn how to create managed database objects in Chapter 9.
Which of the following services of SQL Server 2005 allows you to implement
message-based communication?
1. Full-text search
2. Service Broker
3. Notification services
4. Replication
Answer:
2. Service broker
Which of the following services of SQL Server 2005 allows you to gather and integrate
data from disparate data sources in an organization?
1. Analysis services
2. Integration services
3. Notification services
4. Replication
Answer:
2. Integration services
¤NIIT Overview of SQL Server 2005 1.13
The .NET Framework is an environment used to build, deploy, and run business

applications. These applications can be built in various programming languages supported
by the .NET Framework.
The .NET Framework is designed to make significant improvements in code reuse, code
specialization, resource management, multilanguage development, security, deployment,
and administration. Therefore, it helps bridge the gap of interoperability between
applications.
The .NET Framework consists of the following components:
 Development tools and languages
 Base Class Library
 Common Language Runtime (CLR)
Development Tools and Languages
The development tools and languages are used to create the interface for the Windows
forms, Web forms, and console applications. The development tools include Visual Studio
2005 and Visual C# Developer. The languages that can be used are Visual Basic.NET,
C#, or J#. These components are based on the .NET Framework base classes.
Base Class Library
The .NET Framework consists of a class library that acts as a base for any .NET language,
such as Visual Basic, .NET, and C#. This class library is built on the object-oriented
nature of the runtime. It provides classes that can be used in the code to accomplish a
range of common programming tasks, such as string management, data collection,
database connectivity, and file access.
Common Language Runtime (CLR)
The CLR is one of the most essential components of the .NET Framework. It provides an
environment for the application to run. The CLR or the runtime provides functionalities,
such as exception handling, security, debugging, and versioning support to the
applications.
The .NET Framework
1.14 Overview of SQL Server 2005 ¤NIIT
Some of the features provided by the CLR are:
 Automatic memory management: allocates and deallocates memory to the

application as and when required.
 Standard type system: provides a set of common data types in the form of Common
Type System (CTS). This means that the size of integer and long variables is the
same across all programming languages.
 Language interoperability: provides the ability of an application to interact with
another application written in a different programming language. This also helps
maximize code reuse.
 Platform independence: allows execution of a code from any platform that supports
the .NET CLR.
 Security management: applies restrictions on the code to access the resources of a
computer.
The CLR can host a variety of languages and offers a common set of tools across these
languages, ensuring interoperability between the codes. The code developed with a
language compiler that targets the CLR is called a managed code.
Alternatively, the code that is developed without considering the conventions and
requirements of the common language runtime is called unmanaged code. Unmanaged
code executes in the common language runtime environment with minimal services. For
example, unmanaged code may run with limited debugging and without the garbage
collection process.
The components of SQL Server 2005 and the .NET Framework provide various features
to the database server. These features help the developers manage data in an efficient way.
The components of SQL Server 2005 help improve the database management and
developer productivity. These benefits are provided by the following features:
 Built-in support for Extensible Markup Language (XML) data: allows you to
store and manage XML data in variables or columns of the XML data type. The
XML data is the data stored in a structured format that can be used across different
platforms and applications built by using different languages.
 CLR integration: allows you to implement programming logic in any language
supported by the .NET Framework.
 Scalability: allows partitioning of database tables to help in parallel processing of

queries. This makes the database scalable and improves the performance of queries.
Features of SQL Server 2005
¤NIIT Overview of SQL Server 2005 1.15

Service-oriented architecture: provides a distributed, asynchronous application
Framework for large-scale applications. This allows the database clients to send
requests to the database server even if the server is not available to process the
request immediately.
 Support for Web services: allows you to provide direct access to the data from the
Web services by implementing the HTTP endpoints.
 High level of security: implements high security by enforcing policies for log on
passwords. Administrators can also manage permissions granted to different users to
access the database objects.
 High availability: ensures that the database server is available to all users at all
times. This reduces the downtime of the server. High availability in SQL Server 2005
is implemented with the help of database mirroring, failover clustering, and database
snapshots.
 Support for data migration and analysis: provides tools to migrate data from
disparate data sources to a common database. In addition, it allows building the data
warehouse on this data that can support BI applications for data analysis and
decision-making.
As a database developer, you need to manage the database to store, access, and modify
data. SQL is the core language used to perform these operations on the data. SQL,
pronounced as "sequel", is a language that is used to manage data in an RDBMS. This
language was developed by IBM in the 1970s and follows the International Organization
for Standardization (ISO) and American National Standards Institute (ANSI) standards.
Most database systems have created customized versions of the SQL language. For
example, Transact-SQL (T-SQL) is a scripting language used on the SQL Server for
programming. Alternatively, PL-SQL is used for programming in Oracle. T-SQL
confirms to the ANSI SQL-92 standard published by ANSI and ISO in the year 1992.

The SQL statements can be categorized as:
 Data Definition Language (DDL): is used by to define the database, data types,
structures, and constraints on the data. Some of the DDL commands are:
z CREATE: used to create a new database object, such as a table
z ALTER: used to modify the database objects
z DROP: used to delete the objects
 Data Manipulation Language (DML): is used to manipulate the data in the
database objects. Some of the DML commands are:
z INSERT: used to insert a new data record in a table
z UPDATE: used to modify an existing record in a table
SQL
1.16 Overview of SQL Server 2005 ¤NIIT
Just a minute:
z DELETE: used to delete a record from a table
 Data Control Language (DCL): is used to control the data access in the database.
Some of the DCL commands are:
z GRANT: used to assign permissions to users to access a database object
z REVOKE: used to deny permissions to users to access a database object
 Data Query Language (DQL): is used to query data from the database objects.
SELECT is the DQL command that is used to select data from the database in
different ways and formats.
SQL is not a case-sensitive statement. Therefore, you can write the commands in any
case, lowercase or uppercase. For example, you can use the SELECT statement in
lowercase as ‘select’ or in title case as ‘Select’.
Which of the following features of SQL Server 2005 allow the developers to implement
their programming logic in any language supported by the .NET Framework?
1. Support for data migration
2. High availability
3. CLR integration
4. Scalability

Answer:
3. CLR integration
¤NIIT Overview of SQL Server 2005 1.17
SQL Server 2005 provides various tools that help improve the efficiency of database
developers. The SQL Server Management Studio is one such tool that helps in creating
and maintaining database objects. The SQL Server Business Intelligence Development
Studio is another tool that helps in creating and implementing BI solutions. The server
also provides tools, such as the Database Engine Tuning Advisor and the SQL Server
Configuration Manager that help the database administrator in configuring the server and
optimizing the performance.
Before you start working on SQL Server 2005, it is important to identify various tools
provided by the server and their features.
The SQL Server Management Studio is a powerful tool associated with SQL Server 2005.
It provides a simple and integrated environment for developing and managing the SQL
Server database objects. The following figure shows the SQL Server Management Studio
interface.
The SQL Server Management Studio Interface
Identifying SQL Server 2005 Tools
SQL Server Management Studio
1.18 Overview of SQL Server 2005 ¤NIIT
The following table lists the main components of the SQL Server Management Studio
interface.
Component Description
Object Explorer An Object Explorer provides the ability to register, browse, and
manage servers. Using Object Explorer, you can also create, browse,
and manage server components. The Explorer allows you to configure
the following components:
 Security: Used to create log on Ids and users and to assign
permissions.
 Notification Services: Used to generate and send notifications to

users.
 Replication: Used to create and manage publishers and
subscribers.
 SQL Server Agent: Used to automate administrative tasks by
creating and managing jobs, alerts, and operators.
 Management Services: Used to configure Distributed
Transaction Coordinator, Full-Text search, Database Mail
service, or SQL Server logs.
 Server Objects: Used to create and manage backups, endpoints,
and triggers.
Registered Servers A registered server is a list that displays all the servers registered with
the management studio. It also helps record connection information for
each registered server including the authentication type, default
database, network protocol characteristics, encryption, and time-out
parameters.
Solution Explorer The Solution Explorer provides an organized view of your projects and
files. In this explorer, you can right-click on a project or file to manage
or set their properties.
Query Editor The Query Editor provides the ability to execute queries written in
T-SQL. It can be invoked by selecting the New Query option from the
File menu or the New Query button from the Standard toolbar.
Template Explorer The Template Explorer provides a set of templates of SQL queries to
perform standard database operations. You can use these queries to
reduce the time spent in creating queries.
Dynamic Help The Dynamic Help is available from the Help menu of the SQL Server
Management Studio. This tool automatically displays links to relevant
information while users work in the Management Studio environment.
Components of the SQL Server Management Studio Interface
¤NIIT Overview of SQL Server 2005 1.19
The Business Intelligence Development Studio is a tool that provides an environment to

develop business intelligence solutions. These solutions are based on the data that was
generated in the organization and helps in business forecasting and making strategic
decisions and future plans.
The Business Intelligence Development Studio helps build the following types of
solutions:
 Data integration: The integration services allow you to build solutions that integrate
data from various data sources and store them in a common data warehouse.
 Data analysis: The analysis services help analyze the data stored in the data
warehouse.
 Data reporting: The reporting services allow you to build reports in different
formats that are based on the data warehouse.
The Business Intelligence Development Studio contains templates, tools, and wizards to
work with the objects that you can use to create business intelligence solutions.
The Database Engine Tuning Advisor helps database administrators to analyze and tune
the performance of the server. To analyze the performance of the server, the administrator
can execute a set of T-SQL statements against a database. After analyzing the
performance of these statements, the tool provides recommendations to add, remove, or
modify database objects, such as indexes or indexed views to improve performance.
These recommendations help in executing the given T-SQL statements in the minimum
possible time.
The SQL Server Configuration Manager helps the database administrators to manage the
services associated with the SQL Server. By default, in SQL Server 2005 some services,
such as full-text search, SQL Server Agent, and integration services are not enabled.
Administrators can start, pause, resume, or stop these services by using this tool.
In addition, the tool allows you to manage the network connectivity configuration from
the SQL Server client computers. It allows you to specify the protocols through which the
client computers can connect to the server.
SQL Server Business Intelligence Development Studio
Database Engine Tuning Adviso
r

SQL Server Configuration Manage
r
1.20 Overview of SQL Server 2005 ¤NIIT
Just a minute:
Which of the following tools of SQL Server 2005 allow starting and stopping the
full-text search?
1. SQL Server Management Studio
2. Business Intelligence Development Studio
3. Database Engine Tuning Advisor
4. SQL Server Configuration Manager
Answer:
4. SQL Server Configuration Manager
¤NIIT Overview of SQL Server 2005 1.21
1. Which of the following components of SQL Server 2005 is used to copy and
distribute data and database objects from one database server to another?
a. Replication
b. Service broker
c. Full-text search
d. Notification services
2. List the features of SQL Server 2005.
3. What is SQL?
4. What is the use of the DCL statements?
5. In what ways can you use the Object Explorer window of SQL Server
Management Studio?
6. What is the use of the Template Explorer?
7. Which tools are used to manage SQL Server 2005?
8. How can you ensure high availability of the SQL Server 2005 database
server?
Practice Questions
1.22 Overview of SQL Server 2005 ¤NIIT

In this chapter, you learned that:
 A business application can have three elements: user interface, business logic, and
data storage.
 A database server is used to store and manage the database in a business application.
 SQL Server 2005 consists of the following four core components: database engine,
integration services, analysis services, and reporting services.
 The database engine provides support to store, query, process, and secure data on the
database server.
 Integration services allow you to gather and integrate data from disparate data
sources at a common location in a consistent format.
 Analysis services provide data mining solutions that help in data analysis.
 Reporting services provide support to generate comprehensive reports on the data
stored in the database engine or the data warehouse.
 Microsoft SQL Server 2005 is integrated with the .NET Framework.
 The .NET Framework is an environment used to build, deploy, and run business
applications through various programming languages.
 The .NET Framework consists of three components: development tools and
languages, base class library, and CLR.
 SQL Server 2005 provides the following benefits:
z Built-in support for XML data
z CLR integration
z Scalability
z Service-oriented architecture
z Support for Web services
z High level of security
z High availability
z Support for data migration and analysis
 SQL includes:
z DDL: To create and manage database objects
z DML: To store and manage data in database objects

z DCL: To allow or deny access to database objects
z DQL: To query data from the database objects
Summary
¤NIIT Overview of SQL Server 2005 1.23

SQL Server 2005 provides the following tools to improve the efficiency of the
database developers and manage the server:
z SQL Server Management Studio
z SQL Server Business Intelligence Management Studio
z Database Engine Tuning Advisor
z SQL Server Configuration Manager
1.24 Overview of SQL Server 2005 ¤NIIT

×