Module 3
Microsoft SQL SERVER
2008
Prepared by: Engr. Cherryl D. Cordova
SQL Servers Networked Architecture
SQL Server Client
Windows NT
Windows 9x
Database Engine
And Data Storage
Linux
SQL Server
Windows 2000
Prepared by: Engr. Cherryl D. Cordova
UNIX
Features and Tools
SQL Server Studios
Help with the development and management
tasks
SQL Server Management Studio an integrated
environment for accessing, configuring, managing, and
administering all components of SQL Server.
Business Intelligence Development Studio an
integrated environment for developing business
intelligence applications.
Prepared by: Engr. Cherryl D. Cordova
SQL Server Profiler Reference a tool that
captures SQL Server events from a server. The
events are saved in a trace file that can later be
analyzed or used to replay a specific series of
steps when trying to diagnose a problem.
SQL Server Configuration Manager a tool to
manage the services associated with SQL Server,
to configure the network protocols used by SQL
Server, and to manage the network connectivity
configuration from SQL Server client computers.
Prepared by: Engr. Cherryl D. Cordova
Database Engine Tuning Advisor helps you
select and create an optimal set of indexes,
indexed views, and partitions without
requiring an expert understanding of the
structure of the database or the internals of
SQL Server.
Command Prompt Utilities provides
additional tools that can be run from the
command prompt.
Prepared by: Engr. Cherryl D. Cordova
SQL Servers Data Access Architecture
OLE DB
Application
ADO
Client Computer
ODBC
Application
DAO
SQL Server
OLE DB
Provider
DB-Library
application
Embedded SQL
application
SQL Server
DB-Library .dll
SQL Server DBLibrary .dll
RDO
SQL Server
ODBC Driver
Client Net-libraries
Network
Server Net-libraries
SQL Server
Computer
Open Data Services
SQL Server
Prepared by: Engr. Cherryl D. Cordova
Extended stored procedures
6
SQL Server Management Studio
It is the core administration and management
tool that enables you to perform database
management, backup and restore operations,
as well as set up security and database
replication. It enables you to view and work
with all the different SQL Server components
using a hierarchical tree view.
Prepared by: Engr. Cherryl D. Cordova
Features in SQL Server Management
Studio
Supports most administrative tasks for SQL
Server.
A single, integrated environment for SQL Server
Database Engine management and authoring.
New management dialogs for managing objects
in the SQL Server Database Engine, Analysis
Services, Reporting Services, Notification
Services, and SQL Server Compact 3.5, that allows
you to execute your actions immediately, send
them to a Code Editor, or script them for later
execution.
Prepared by: Engr. Cherryl D. Cordova
Non-modal and resizable dialogs allow access to
multiple tools while a dialog is open.
A common scheduling dialog that allows you to
perform action of the management dialogs at a
later time.
Exporting and importing SQL Server Management
Studio server registration from one Management
Studio environment to another.
Save or print XML Showplan or Deadlock files
generated by SQL Server Profiler, review them
later, or send them to administrators for analysis.
Prepared by: Engr. Cherryl D. Cordova
A new error and informational message box
that presents much more information
An integrated Web browser for quick browsing
of MSDN or online help.
Prepared by: Engr. Cherryl D. Cordova
10
To access SQL Server Management Studio
On the taskbar, click Start, point to All Programs,
point to Microsoft SQL Server SQL Server 2008,
and then click SQL Server Management Studio.
Note: By default, SQL Server Management Studio
is installed in C:\Program Files\Microsoft SQL
Server\100\Tools\Binn\VSShell\Common7\IDE.
Prepared by: Engr. Cherryl D. Cordova
11
Tool Windows in SQL Server
Management Studio
Object Explorer
browse servers, create and locate objects, manage
data sources, and view logs. This tool is accessed
from the View menu.
a component of SQL Server Management Studio,
connects to Database Engine instances, Analysis
Services, Integration Services, Reporting Services,
and SQL Server Compact 3.5.
provides a view of all the objects in the server and
presents a user interface to manage them.
Prepared by: Engr. Cherryl D. Cordova
12
SQL Server Database Engine
It is the core service for storing, processing, and
securing data.
It provides controlled access and rapid
transaction processing to meet the requirements
of the most demanding data consuming
applications within your enterprise.
It is used to create relational databases for online
transaction processing or online analytical
processing data.
Prepared by: Engr. Cherryl D. Cordova
13
Viewing Object Explorer
Object Explorer is visible in the Management
Studio by default. If you cannot see Object
Explorer, on the View menu, click Object Explorer.
Connecting Object Explorer to a Server
Click Connect on the Object Explorer toolbar and
choose the type of server from the drop-down list.
To connect, you must provide at least the name of
the server and the correct authentication
information.
Prepared by: Engr. Cherryl D. Cordova
14
Viewing Objects in Object Explorer
Object Explorer uses a tree structure to group
information into folders.
To expand folders, click the plus sign (+) or doubleclick the folder.
Right-click folders or objects to perform common
tasks.
Double-click objects to perform the most common
task.
To refresh the list of objects within a folder, rightclick the folder, and then click Refresh.
Prepared by: Engr. Cherryl D. Cordova
15
SQL SERVER Database Architecture
SQL Server
Databases
Objects
Tables
Columns
Indexes
Constraints
Triggers
views
Rules
Defaults
Stored Procedures
Prepared by: Engr. Cherryl D. Cordova
16
Database
4 System Databases
Master
keeps track of all data values that affect the operation of SQL
Server. It contains information about the login accounts, the
existence of all the other SQL Server databases, and all the
servers configuration settings.
Model
a template SQL Server uses to create new databases. It
contains the system tables used by each database. The
system tables keep track of the database options, including
default settings, user authorities, and database rules.
Prepared by: Engr. Cherryl D. Cordova
17
Msdb
contains information about scheduling jobs and alerts,
as well as tracking the operators that receive alerts.
Tempdb
is used to store temporary tables built by SQL Server. It
is re-created each time SQL server is started. It is a
global resource, and all users must have permission to
use it.
Prepared by: Engr. Cherryl D. Cordova
18
Database Objects
Tables An organized set of columns. Each set
of columns is referred to as a row.
Two Types:
System Tables contain information about SQL Server
and its various objects. Named with the prefix sys
User Table contain user data, and represents some
type of entity
Prepared by: Engr. Cherryl D. Cordova
19
Columns are the data items that represent a
property of the entity type represented by the table.
It is also called as fields. Each column must have a
given data type.
Indexes are used to optimize SQL Servers data
access speed. An index is created as a separate
database object from the original table.
2 Basic Types of Indexes
Clustered Indexes force the SQL Server to
store the data in the base table using the same
organization as the clustered index.
Nonclustered Indexes dont altered the way
the data is stored in the base table
Prepared by: Engr. Cherryl D. Cordova
20
Constraints ensure data integrity for SQL Server tables
and columns. It is generally added when a table is
created, and they can be specified at the table or column
level.
5 Types of Constraints
Primary Key used for entity integrity. It ensures
all rows in a table have a unique key that isnt null.
Foreign Key used for referential integrity. It
associates one or more columns in a table with
a primary key that has been defined in another
table. Ensures a specified relationship exists
between two tables.
Prepared by: Engr. Cherryl D. Cordova
21
Unique prevents any one column or se t of columns from
having a duplicate value. It cant be defined on a column
thats part of a primary key. It can allow null value.
Check enforces domain integrity by restricting the range
of values that can be entered into a column.
Not Null used to ensure a column wont contain any null
values.
Triggers a stored procedure that is automatically
executed when a SQL Server table is modified using
the Update, Insert, or Delete operations.
Prepared by: Engr. Cherryl D. Cordova
22
Views
doesnt actually exist as a separate table,but,
instead, is stored as a Select Statement that
references one or more base tables.
It can be queried just like base tables.
Common uses include selecting a subset of rows
or columns from a table, joining columns from
different tables, and summarizing the data from
one or more columns.
Prepared by: Engr. Cherryl D. Cordova
23
Rules
similar to check constraints because they restrict
the values that can be entered into a column It
can be queried just like base tables.
Defaults
specifies the value used automatically for a given
column when no data values are explicitly
assigned to the column and a new row is inserted.
Stored Procedures
are a group of Transact-SQL statement compiled
into a single execution plan at the time the stored
procedure is created.
Prepared by: Engr. Cherryl D. Cordova
24
Transact-SQL
A high-level language originally developed by
IBM to provide access to the data contained in
relational databases.
Standardized by American National Standards
Institute (ANSI)
Commonly used for database management
tasks
Prepared by: Engr. Cherryl D. Cordova
25
3 Categories of Transact-SQL
Data Definition Language (DDL)
commands are used for database management
tasks such as creating tables and views.
Data Manipulation Language (DML)
commands are used to query or update the data
contained in the database.
Data Control Language (DCL
commands are used to control the database
operations.
Prepared by: Engr. Cherryl D. Cordova
26