Transcript Slides

David M. Kroenke’s
Database Processing:
Fundamentals, Design, and Implementation
Chapter Eleven:
Managing Databases with
SQL Server 2000
Part One
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
11-1
Introduction
• SQL Server 2000 can be installed on:
– Windows 2000 and Windows XP workstations
– Windows 2000 Server and Windows Server 2003
• There are two ways to create database, to insert data,
and to modify its structure:
– Use the GUI SQL Server Enterprise Manager
– Write SQL statements and submit them to SQL Server via the
SQL Query Analyzer utility
• Many SQL Server professionals choose to create
structures via SQL then modify them with the graphical
tools
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
11-2
View Ridge Gallery
• View Ridge Gallery is a small art gallery that has
been in business for 30 years
• It sells contemporary European and
North American fine art
• View Ridge has one owner,
three salespeople, and two workers
• View Ridge owns all of the art that it sells;
it holds no items on a consignment basis
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
11-3
Application Requirements
• View Ridge application requirements:
– Track customers and their artist interests
– Record gallery's purchases
– Record customers' art purchases
– List the artists and works that have appeared
in the gallery
– Report how fast an artist's works have sold
and at what margin
– Show current inventory in a Web page
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
11-4
View Ridge Gallery Database Design
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
11-5
The IDENTITY Keyword
• SQL Server supports the SQL-92 standard
• The IDENTITY keyword implements a new
constraint for surrogate keys:
– IDENTITY (m, n) creates a surrogate key with an
Identity Seed of m and an Identity Increment of n:
CREATE TABLE CUSTOMER(
CustomerID int
NOT
Name
char(25)NOT
CONSTRAINT CustomerPK
CONSTRAINT CustomerAK1
);
NULL IDENTITY (1000,1),
NULL,
RIMARY KEY (CustomerID),
UNIQUE (Name)
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
11-6
SQL Server Enterprise Manager
Right-Click Databases, then use New Database… to create a new database
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
11-7
Creating a Database
Type in the new
database name, and
then click the OK
button.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
11-8
SQL Query Analyzer:
Starting SQL Query Analyzer from Enterprise Manager
Use the menu
command Tools
| SQL Query
Analyzer.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
11-9
SQL Query Analyzer:
Creating the TRANS table in SQL Query Analyzer
Use the Execute
Query button
after the SQL
command is
entered.
Enter the SQL
command in this
window.
Results appear
in this window.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
11-10
David M. Kroenke’s
Database Processing
Fundamentals, Design, and Implementation
(10th Edition)
End of Presentation:
Chapter Eleven Part One
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
© 2006 Pearson Prentice Hall
11-11