2008 Tutorial 1: Introduction
IT 4153 Advanced Database
J.G. Zheng Spring 2012
Overview
SQL Server introduction
SQL Server installation notes First feel of SQL Server
Configuration Manager Folders and files Attach a sample database Using management Studio
2
SQL Server Overview
SQL Server is a relational database management and analysis system by Microsoft
Targeting the enterprise-level database market
Major versions
SQL SQL SQL SQL SQL SQL
Server Server Server Server Server Server
7.0 (Windows NT) 2000 (Windows Server 2000) 2005 (Windows Server 2003) 2008 (Windows Server 2008) 2008 R2 (Windows Server 2008) 2012 (coming soon)
3
SQL Server Services
Database Engine is the core service for storing, processing and securing data. Analysis Services (SSAS)
Multidimensional Data supports OLAP by allowing you to design, create, and manage multidimensional structures. Data Mining enables you to design, create, and visualize data mining models.
Reporting Services (SSRS) delivers enterprise, Web-enabled reporting functionality to create reports, publish reports in various formats, and centrally manage security and subscriptions. Integration Services (SSIS) is a platform for building high performance data integration solutions, including ETL processing for data warehousing.
4
SQL Server Editions
Data center
Standard/Enterprise Developer
Full features with only development license
Express
Offers database engine service and management tools for free
5
http://www.microsoft.com/sqlserver/en/us/editions.aspx
SQL Server 2008 Download
Full editions (developer, enterprise, standard)
Download it from SPSU CSE MSDNAA http://cse.spsu.edu/cslab/SoftwareForStudents/MSDNaa/d efault.html
Express Edition
http://www.microsoft.com/sqlserver/en/us/editions/expre ss.aspx Choose 32-bit or 64-bit based on your Windows operating system Make sure to select the option "with tools" (Management Studio), or download the management studio separately
http://www.microsoft.com/download/en/details.aspx?id=7593
Full Edition Installation
SQL Server 2008 is a complex program, so please follow an installation guide to install SQL Server 2008
http://www.sqlcoffee.com/SQLServer2008_00 13.htm http://msdn.microsoft.com/enus/library/ms143219.aspx
Express Edition Installation
Overview of SQL Server 2008 R2 Express Edition: provides a overview of SQL Server 2008 R2 Express and step-by-step installation guide with screenshots:
http://www.sql-serverperformance.com/2010/sql-server-2008-r2/ Note: there are 3 parts of the article
Make sure you have these features/components installed
Database Engine Services Management Tools
Post-Installation Check
Use the SQL Server Configuration Manager to view service status Login through the Management Studio Attach sample database files
Navigate the database and other objects in the Management Studio
9
First Feel of SQL Server 2008
Configuration manager SQL Server Management Studio
Login Basic interface: object explorer and tool bar
Database engine
Databases, tables, and other objects Retrieving table data Designing tables and columns Editing tables and records Relationship diagram
Queries and views
Query editor Running queries
10
Major Tools
Management Studio Configuration Manager Books Online and Tutorials
11
Configuration Manager
Configuration manager is a tool to view SQL Server service status, start or stop services
http://technet.microsoft.com/en-us/library/ms174212.aspx
Make sure the database server is running
12
SQL Server Management Studio
SQL Server Management Studio is a major tool to control the DBMS Start Management Studio (in the SQL Server 2008 program menu) and login using the Windows Authentication
Use your Computer Name (or (local)) and Instance Name (connected by \) as the server name.
13
Run as Administrator
on Windows 7 or Vista, you may need to right click the program command and select Run as Administrator; otherwise later you will get Access Denied when attaching database files.
14
Object Explorer
Object Explorer: all databases and other objects are here.
15
Attach Sample Databases (1)
Download the Northwind sample database and extract the two files to a folder
Right click on Databases to bring up the menu.
Northwind2003-mini.mdf Northwind2003-mini_log.ldf The 2 files must be in the same folder
Note
Its recommended that database files should be put into a designated folder where you know its directory path, otherwise you will have a difficult time to find them later.
16
Attach Database (2)
2. Select the Northwind2003-mini.mdf file and click OK. You need to remember in which folder you put the two database files.
1. Click the add button
3. Click the OK button. Note: on Windows 7 or Vista, you may want to right click the command icon and select Run as Administrator, otherwise you may get a warning permission denied.
17
Attach Database (3)
1. Make sure the owner is your computer account
2. All SQL Server databases include two files: .MDF the main database file .LDF the log file Make sure the log file is loaded successfully.
If you get Access Denied error when attaching database files (on Windows 7 or Vista), you may need to run the Management Studio as an administrator; See slide #14.
18
Table Data
Right click for menus
19
Database Diagram
View a diagram of tables, columns and relationships.
If you cannot view the diagram, its probably because you are not the owner of this database. Right click the current database, and select properties, then see the next slide.
20
Database Properties
Go to the Files Tab.
Make sure the owner is your Windows login account. If not, click this bottom to change the owner.
Click the Browse button to look for your Windows login account. The account name is preceded by the computer name.
21
Table Design Metadata
Right click on a table and select Design
22
Using Management Studio
SQL Server Management Studio
http://technet.microsoft.com/enus/library/ms174173.aspx
Attaching and Detaching Databases
http://msdn.microsoft.com/enus/library/ms190794.aspx http://msdn.microsoft.com/enus/library/ms190209.aspx http://msdn.microsoft.com/enus/library/ms191491.aspx
23
Readings and Resources
SQL Server introduction on Wikipedia
http://en.wikipedia.org/wiki/Microsoft_SQL_Server
SQL Server 2008 tutorials
http://msdn.microsoft.com/en-us/library/ms167593(v=SQL.100).aspx
Features and Tools Overview
http://technet.microsoft.com/en-us/library/bb500397.aspx
SQL Server editions and components
http://msdn.microsoft.com/en-us/library/ms144275(v=SQL.100).aspx
SQL Server 2008 Books Online
http://msdn.microsoft.com/en-us/library/ms130214(v=SQL.100).aspx
SQL Server official website
http://www.microsoft.com/sqlserver
SQL Server samples from the community
http://sqlserversamples.codeplex.com/
24