Professional Documents
Culture Documents
Introduction
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 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.
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:
With a small list like this, a text file may serve our purposes perfectly.
Microsoft Access
Filemaker
Microsoft SQL Server
MySQL
Oracle
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:
Under the title bar, the menu bar displays categories of menus that you will use to
perform the various necessary operations.
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.
Right-click any menu item on the main menu or any button on a toolbar:
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.
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