You are on page 1of 11

Chapter 1

Introduction

Microsoft SQL Server is a computer application used to create desktop,


enterprise, and web-based database applications. It is used at different levels and
with various goals.

Microsoft SQL Server is an application used to create computer databases for


the Microsoft Windows family of server operating systems. Microsoft SQL Server
provides an environment used to generate databases that can be accessed from
workstations, the Internet, or other media such as a personal digital assistant
(PDA).

Microsoft SQL Server is a Relational Database Management System (RDBMS)


designed to run on platforms ranging from laptops to large multiprocessor servers.

SQL Server is commonly used as the backend system for websites and corporate
CRMs and can support thousands of concurrent users.

SQL Server comes with a number of tools to help you with your database
administration and programming tasks.

SQL Server is much more robust and scalable than a desktop database
management system such as Microsoft Access. Anyone who has ever tried using
Access as a backend to a website will probably be familiar with the errors that
were generated when too many users tried to access the database! Although SQL
Server can also be run as a desktop database system, it is most commonly used as a
server database system.

SQL is an acronym for Structured Query Language and is a standard relational


query language (SQL has been standardized by both ANSI and ISO) used for
interaction with databases. SQL was developed by IBM in 1970s and has its roots
in the relational algebra defined by Codd in 1972.

SQL defines many keywords, which can be divided into several categories:

The first SQL keyword category is for keywords used for data retrieval like the
SELECT keyword. The second category is for the SQL keywords used for data
manipulation like the INSERT, UPDATE, and DELETE SQL keywords. The
third category is the transactional SQL keywords category, featuring keywords
like COMMIT and ROLLBACK.

Another SQL keyword category is the SQL Data Definition Language category
featuring words like CREATE and DROP.

Yet another category of SQL keywords controls the authorization and


permission aspects of RDBMS (GRANT and REVOKE keywords).
SQL is pronounced as “S-Q-L” or “see-quill”.
SQL commands are not case sensitive and the following SQL queries are
equivalent:

SELECT * FROM Users

Select * from Users


System Databases

If you've only just installed SQL Server, you might notice that some databases
have already been created. These are system and sample databases.
Database Type Description
Master System Stores system level information such as user
databas accounts, configuration settings, and info on all other
e databases.
Model System This database is used as a template for all other
databas databases that are created.
e
Msdb System Used by the SQL Server Agent for configuring alerts
databas and scheduled jobs etc
e
Tempdb System Holds all temporary tables, temporary stored
databas procedures, and any other temporary storage
e requirements generated by SQL Server.
Pubs Sample This database can be used for training purposes, and
databas is based on a book publishing company.
e
Northwin Sample This database can be used for training purposes, and
d databas is based on a fictitious company called "Northwind
e Traders".

What is a Database?

A database is a collection of data. That may sound overly simplistic but it pretty
much sums up what any database is.
A database could be as simple as a text file with a list of names. Or it could be
as complex as a large, relational database management system, complete with
in-built tools to help you maintain the data.

Before we get into dedicated database management systems, let's start with the
basics - let's look at a simple text file example.

Text File

Imagine we have a text file called "Individual.txt", and that the contents look like
this:

We could use this information to do things such as send an email to everyone on


our list. We could do this because, due to the way we designed the list, we know
that each row contains a different individual, and the information on that row is
related to that individual. Also, the items in each row are separated by commas.
Therefore, we know that the email address next to "Homer" is his email address.
We could also call each row a record. Therefore, we currently have 4 records in
our database.

With a small list like this, a text file may serve our purposes perfectly.

Database Management Systems

A Database Management System (DBMS): is a software program that enables


the creation and management of databases. Generally, these databases will be more
complex than the text file/spreadsheet example in the previous lesson. In fact, most
of today's database systems are referred to as a Relational Database Management
System (RDBMS), because of their ability to store related data across multiple
tables.

Some of the more popular relational database management systems include:

 Microsoft Access
 Filemaker
 Microsoft SQL Server
 MySQL
 Oracle

SQL Server - Create a Database

One of the first things we should look at with SQL Server is how to create a
database. After all, most of the tasks you perform with SQL Server will evolve
around one or more databases.

To follow our lessons, you must have access to a computer in which Microsoft
SQL Server 2008 is installed. To start, you must have a computer that runs an
appropriate operating system. If you are just learning, you can use a computer that
runs Microsoft Windows XP Professional, Microsoft Windows Vista,
Microsoft Windows 7 (Professional or Ultimate), Microsoft Windows Server
2003, or Microsoft Windows Server 2008.

Before installing Microsoft SQL Server 2008, make sure you have installed all
service packs on your operating system.
Opening Microsoft SQL Server

 To launch Microsoft SQL Server, you can click Start -> (All) Programs
-> Microsoft SQL Server 2008 -> SQL Server Management Studio

When it starts, it would present a dialog box that expects you to log in the splash
screen appears:

All Computers: On the Connect to Server dialog box, click Cancel


The top section of the SQL Server Management Studio displays the classic title
bar of a regular window, with an icon on the left, followed by the title of the
application, and the system buttons on the right side.

The Main Menu

Under the title bar, the menu bar displays categories of menus that you will use to
perform the various necessary operations.

The Standard Toolbar

The Standard toolbar displays under the main menu:

The Standard toolbar is just one of the available ones.

Eventually, when you perform an action that would benefit from another toolbar,
the Microsoft SQL Server Management Studio would display that toolbar. Still, if
you want to show any toolbar, you can right-click any menu item on the main
menu or any button on a toolbar.

Checking the Toolbars:

 Right-click any menu item on the main menu or any button on a toolbar:

The Object Explorer:

The left side of the interface displays, by default, the Object Explorer
window, with its title bar labeled Object Explorer. If you don't see it, on the main
menu, you can click View -> Object Explorer.

The Object Explorer is a lockable window, meaning you can move it from
the left side to another side on the interface. To do this, you can click and drag its
title bar to a location of your choice. When you start dragging, small boxes that
represent the possible placeholders would come up:
You can drag and drop to one of those placeholders.

The Object Explorer is also floatable, which means you can place it somewhere
in the middle of the interface:

To place the window back to its previous position, you can double-click its
title bar. The window can also be tabbed. This means that the window can be
positioned either vertically or horizontally.

At any time, if you do not want the Object Explorer, you can close or hide
it. To close the Object Explorer, click its close button.
On the right side of the Object Explorer title, there are three buttons. If you
click the first button that points down, a menu would appear:

The menu allows you to specify whether you want the window to be floated,
docked, or tabbed.

The right side of the window is made of an empty window. This area will be used
to display either the contents of what is selected in the Object Explorer, or to show
a result of some operation. As you will see later on, many other windows will
occupy the right section but they will share the same area. To make each known it
will be represented with a tab and the tab shows the name (or caption) of a
window.

Close Microsoft SQL Server:

After using Microsoft SQL Server Management Studio, you can close it. To do
this:

 Click the icon on the left side of Microsoft SQL Server Management Studio
and click Close
 On the right side of the title bar, click the system Close button
 On the main menu, click File -> Exit
 Press Alt, F, X

END

You might also like