MySQL and mSQL Randy Jay Yarger, George Reese, and Tim King Beijing • Cambridge • Farnham • Köln • Paris • Sebastopol • Taipei • Tokyo MySQL and mSQL by Randy Jay Yarger, George Reese, and Tim King Copyright © 1999 O'Reilly & Associates, Inc. All rights reserved. Printed in the United States of America. Published by O'Reilly & Associates, Inc., 101 Morris Street, Sebastopol, CA 95472. Editor: Andy Oram Production Editor: Jeffrey Liggett Editorial and Production Services: Electro-Publishing Printing History: July 1999: First Edition. Nutshell Handbook, the Nutshell Handbook logo, and the O'Reilly logo are registered trademarks of O'Reilly & Associates, Inc. Java™ and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc., in the United States and other countries. O'Reilly & Associates, Inc. is independent of Sun Microsystems. 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 O'Reilly & Associates, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. The association between the image of kingfishers and the topic of MySQL and mSQL is a trademark of O'Reilly & Associates, Inc. While every precaution has been taken in the preparation of this book, the publisher assumes no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. This book is printed on acid-free paper with 85% recycled content, 15% post-consumer waste. O'Reilly & Associates is committed to using paper with the highest recycled content available consistent with high quality. ISBN: 1-56592-434-7 [9/99] Preface ix I. Getting Started with MySQL and mSQL 1 1. Introduction to Relational Databases 3 What is a Database? 4 What is a Relational Database? 5 Applications and Databases 6 MySQL and mSQL 7 2. Database Design 13 Database Design 13 Normalization 16 A Logical Data Modeling Methodology 25 Physical Database Design 26 3. Installation 30 MySQL 30 mSQL 37 4. MySQL 39 Design 39 Installing MySQL 41 Running MySQL 41 Database Administration 42 MySQL Utilities 58 Performance Tuning 62 5. mSQL 68 Design 68 mSQL Versions 70 Installing mSQL 72 Running mSQL 73 Database Administration 77 mSQL Utilities 84 6. SQL According to MySQL and mSQL 90 SQL Basics 90 Creating and Dropping Tables 93 SQL Datatypes 94 Indices 100 Sequences and Auto-Incrementing 101 Managing Data 103 Queries 105 Extended Functionality 109 7. Other Mid-Range Database Engines 113 What is "Free"? 113 What MySQL and mSQL Lack 114 PostgreSQL 117 GNU SQL 118 Beagle 119 Making Comparisons 119 II. Database Programming 121 8. Database Application Architectures 123 The Client/Server Architecture 123 Data Processing 124
Description: