1. Trang chủ
  2. » Công Nghệ Thông Tin

A Developer''''s Guide to Data Modeling for SQL Server doc

299 613 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 299
Dung lượng 2,85 MB

Nội dung

www.it-ebooks.info Praise for A Developer’s Guide to Data Modeling for SQL Server “Eric and Joshua do an excellent job explaining the importance of data modeling and how to do it correctly. Rather than relying only on academic concepts, they use real-world ex- amples to illustrate the important concepts that many database and application develop- ers tend to ignore. The writing style is conversational and accessible to both database design novices and seasoned pros alike. Readers who are responsible for designing, imple- menting, and managing databases will benefit greatly from Joshua’s and Eric’s expertise.” —Anil Desai, Consultant, Anil Desai, Inc. “Almost every IT project involves data storage of some kind, and for most that means a relational database management system (RDBMS). This book is written for a database- centric audience (database modelers, architects, designers, developers, etc.). The authors do a great job of showing us how to take a project from its initial stages of requirements gathering all the way through to implementation. Along the way we learn how to handle some of the real-world design issues that typically surface as we go through the process. “The bottom line here is simple. This is the book you want to have just finished read- ing when your boss says ‘We have a new project I would like your help with.’” —Ronald Landers, Technical Consultant, IT Professionals, Inc. “The Data Model is the foundation of the application. I’m pleased to see additional books being written to address this critical phase. This book presents a balanced and pragmatic view with the right priorities to get your SQL server project off to a great start and a long life.” —Paul Nielsen, SQL Server MVP, SQLServerBible.com “This is a truly excellent introduction to the database design methodology that will work for both novices and advanced designers. The authors do a good job at explaining the ba- sics of relational database modeling and how they fit into modern business architecture. This book teaches us how to identify the business problems that have to be satisfied by a database and then proceeds to explain how to build a solid solution from scratch.” —Alexzander N. Nepomnjashiy, Microsoft SQL Server DBA, NeoSystems North-West, Inc. “A Developer’s Guide to Data Modeling for SQL Server explains the concepts and prac- tice of data modeling with a clarity that makes the technology accessible to anyone build- ing databases and data-driven applications. “Eric Johnson and Joshua Jones combine a deep understanding of the science of data modeling with the art that comes with years of experience. If you’re new to data model- ing, or find the need to brush up on its concepts, this book is for you.” —Peter Varhol, Executive Editor, Redmond Magazine www.it-ebooks.info This page intentionally left blank www.it-ebooks.info A Developer’s Guide to Data Modeling for SQL Server C OVERING SQL S ERVER 2005 AND 2008 www.it-ebooks.info This page intentionally left blank www.it-ebooks.info A Developer’s Guide to Data Modeling for SQL Server C OVERING SQL S ERVER 2005 AND 2008 Eric Johnson Joshua Jones Upper Saddle River, NJ • Boston • Indianapolis • San Francisco New York • Toronto • Montreal • London • Munich • Paris • Madrid Capetown • Sydney • Tokyo • Singapore • Mexico City www.it-ebooks.info Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals. The authors and publisher have taken care in the preparation of this book, but make no expressed or implied war- ranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein. The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests. For more information, please contact: U.S. Corporate and Government Sales (800)382-3419 corpsales@pearsontechgroup.com For sales outside the United States please contact: International Sales international@pearsoned.com Visit us on the Web: informit.com/aw Library of Congress Cataloging-in-Publication Data Johnson, Eric, 1978– A developer’s guide to data modeling for SQL server : covering SQL server 2005 and 2008 / Eric Johnson and Joshua Jones. — 1st ed. p. cm. Includes index. ISBN 978-0-321-49764-2 (pbk. : alk. paper) 1. SQL server. 2. Database design. 3. Data structures (Computer science) I. Jones, Joshua, 1975- II. Title. QA76.9.D26J65 2008 005.75'85—dc22 2008016668 Copyright © 2008 Pearson Education, Inc. All rights reserved. Printed in the United States of America. This publication is protected by copyright, and permis- sion must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or trans- mission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permissions, write to: Pearson Education, Inc. Rights and Contracts Department 501 Boylston Street, Suite 900 Boston, MA 02116 Fax (617) 671-3447 ISBN-13: 978-0-321-49764-2 ISBN-10: 0-321-49764-3 Text printed in the United States on recycled paper at Courier in Stoughton, Massachusetts. First printing, June 2008 www.it-ebooks.info For Michelle and Evan—Eric To my wife and children; I have time to play now—Josh www.it-ebooks.info This page intentionally left blank www.it-ebooks.info ix C ONTENTS Preface xv Acknowledgments xvii About the Authors xix PART I Data Modeling Theory . . . . . . . . . . . . . . . . . . . . . . . 1 Chapter 1 Data Modeling Overview . . . . . . . . . . . . . . . . . . . . . . . . . 3 Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Relational Database Management Systems. . . . . . . . . . . . . . . . . . . . . . . 5 Why a Sound Data Model Is Important . . . . . . . . . . . . . . . . . . . . . . . . 6 Data Consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Scalability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Meeting Business Requirements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Easy Data Retrieval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Performance Tuning. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 The Process of Data Modeling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Modeling Theory. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Business Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Building the Logical Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Building the Physical Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Chapter 2 Elements Used in Logical Data Models . . . . . . . . . . . . . . 23 Entities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Primary and Foreign Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Domains. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Single-Valued and Multivalued Attributes . . . . . . . . . . . . . . . . . . . . . . . 32 Referential Integrity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 www.it-ebooks.info [...]... Systems A relational database management system (RDBMS) is a software product that stores relational databases In addition to storing databases, RDBMSs provide many other functions They give you a way to secure the databases and manage user access They also have functions that allow you to manage your databases, functions such as backup and restore, index management, data loading utilities, and even reporting... start talking about relational databases, we knock other databases off the list Things like spreadsheets, text files, or napkins inherently stand alone and cannot be related to other objects From this point forward, when we talk about databases, we are referring to relational databases that contain collections of tables that can relate to one another Relational Database Management Systems A relational... storing data, you could call it a database So why don’t we store all of our important information on napkins? The main reason is that we don’t want to lose a customer’s order in the washing machine Seriously, when we store data we need a database that can hold information in a logical way and allow data retrieval When you think of a database, you should really think of something with tables that are made... database is anything that contains information A database can be either logical or physical (or both) You will hear many companies refer to any internal information as the company’s database In fact, I once had a discussion with a manager of mine as to whether a napkin could be a database If you think about it, I could indeed write something on a napkin and it could be a record Because it is storing data, ... like from the manufacturers and then takes orders and sells those appliances to its customers (retail stores) What Tom doesn’t know is how to take that information, model it, and ultimately store it in a database so that it can be leveraged to help the company make decisions or control a process In addition to finding out what information your customer cares about and getting it into a database, you must... customer intends to use the information Is it for historical purposes, or will the company use the data in its daily operations? Will it be used only to produce reports, or will an application need to manipulate the data regularly? As if that weren’t enough, you eventually have to think about turning your data model into a physical database There are many choices on the market when it comes to database... do on the data model, things change and new data becomes available A sound data model will provide for scaling This means that customers can continue to add records to the database, and the model will not run into problems Similarly, adding new information to existing entities should be no harder than adding an attribute (discussed later in this chapter) In contrast, a poorly modeled database will be... experience Years before I was properly introduced to the world of relational database management systems, I started, as many people do, by playing with Microsoft Access to build a database for a small Visual Basic application I was writing I was working as a trainer and just starting to take Microsoft certification exams to become a Microsoft Certified Systems Engineer (MCSE) As part of my job as a trainer,... and columns Each table contains information pertaining to a single “topic,” and each row contains data about a single instance of that topic Figure 1.1 shows a simple logical model containing information about employees and their computers www.it-ebooks.info Databases 5 FIGURE 1.1 A simple relational database containing employee and computer information The Employee table holds all the pertinent data. .. will spend too much time trying to figure it out and too little time leveraging it Granted, you probably won’t spend a lot of time modeling data to be stored in a spreadsheet, but these same kinds of things can happen in a database Scalability When all is said and done, you want to build a database that the customer can use immediately and also for the foreseeable future No matter how good a job you . redesigning an existing database to be migrated from another platform to SQL Server. We’ve all read that software design, and relational database design in particular, should be platform agnostic www.it-ebooks.info Praise for A Developer’s Guide to Data Modeling for SQL Server “Eric and Joshua do an excellent job explaining the importance of data modeling and how to do it correctly. Rather than relying. SQL Server DBA, NeoSystems North-West, Inc. A Developer’s Guide to Data Modeling for SQL Server explains the concepts and prac- tice of data modeling with a clarity that makes the technology accessible

Ngày đăng: 31/03/2014, 21:22

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN