You are previewing Creating your MySQL Database: Practical Design Tips and Techniques.
O'Reilly logo
Creating your MySQL Database: Practical Design Tips and Techniques

Book Description

A short guide for everyone on how to structure your data and set-up your MySQL database tables efficiently and easily.

  • How best to collect, name, group, and structure your data

  • Design your data with future growth in mind

  • Practical examples from initial ideas to final designs

  • The quickest way to learn how to design good data structures for MySQL

  • From the author of Mastering phpMyAdmin

In Detail

For most of us, setting up the database for an application is often an afterthought. While you don't need to be a professional database designer to create a working application, knowing a few insider tips and techniques can make both the process easier and the end result much more effective. This book doesn't set out to make you an expert in data analysis, but it does provide a quick and easy way to raise your game in this essential part of getting your application right.

If you're creating a dynamic web application using open-source tools, then you're probably going to be setting up a MySQL database. Getting the design of this database right for your application and its data is vital, but it's often an intimidating and little-known process for non-developers and developers alike. Written by the creator of the popular phpMyAdmin tool, this book is a short but complete guide on how to design good data structures for MySQL.

Table of Contents

  1. Creating your MySQL Database: Practical Design Tips and Techniques
    1. Creating your MySQL Database: Practical Design Tips and Techniques
    2. Credits
    3. About the Author
    4. About the Reviewer
    5. 0. Preface
      1. What This Book Covers
      2. What You Need for This Book
      3. Conventions
      4. Reader Feedback
      5. Customer Support
        1. Downloading the Example Code for the Book
        2. Errata
        3. Questions
    6. 1. Introducing MySQL Design
      1. MySQL's Popularity and Impact
        1. The Need for MySQL Design
        2. "What do I do Next?"
        3. Data Design Steps
      2. Data as a Resource
        1. But this is my Data!
      3. Data Modeling
        1. Overview of the Relational Model
          1. Rule #1
          2. Rule #2
        2. Simplified Design Technique
      4. Case Study
        1. Our Car Dealer
        2. The System's Goals
      5. The Tale of the Too Wide Table
      6. Summary
    7. 2. Data Collecting
      1. System Boundaries Identification
        1. Modular Development
        2. Model Flexibility
      2. Document Gathering
        1. General Reading
        2. Forms
        3. Existing Computerized Systems
      3. Interviews
        1. Finding the Right Users
        2. Perceptions
        3. Asking the Right Questions
          1. Existing Information Systems
          2. Chronological Events
          3. Sources and Destinations
          4. Urgency
        4. Avoid Focusing on Reports and Screens
      4. Data Collected for our Case Study
        1. From the General Manager
        2. From the Salesperson
        3. From the Store Assistant
        4. Other Notes
      5. Summary
    8. 3. Data Naming
      1. Data Cleaning
      2. Subdividing Data Elements
        1. Data Elements Containing Formatting Characters
      3. Data that are Results
      4. Data as a Column's or Table's Name
      5. Planning for Changes
        1. Pitfalls of the Free Fields Technique
      6. Naming Recommendations
        1. Designer's Creativity
        2. Abbreviations
          1. Clarity versus Length: an Art
          2. Suffixing
        3. The Plural Form
        4. Naming Consistency
        5. MySQL's Possibilities versus Portability
        6. Table Name into a Column Name
      7. Summary
    9. 4. Data Grouping
      1. Initial List of Tables
      2. Rules for Table Layout
        1. Primary Keys and Table Names
        2. Data Redundancy and Dependency
          1. Composite Keys
      3. Improving the Structure
        1. Scalability over Time
        2. Empty Columns
        3. Avoiding ENUM and SET
        4. Multilingual Planning
      4. Validating the Structure
      5. Summary
    10. 5. Data Structure Tuning
      1. Data Access Policies
        1. Responsibility
        2. Security and Privileges
        3. Views
      2. Storage Engines
        1. Foreign Key Constraints
      3. Performance
        1. Indexes
          1. Helping the Query Optimizer: Analyze Table
        2. Accessing Replication Slave Servers
        3. Speed and Data Types
        4. Table Size Reduction
      4. In-Column Data Encoding
      5. Case Study's Final Structure
        1. Vehicle
        2. Person
        3. Sale
        4. Other tables
      6. Summary
    11. 6. Supplemental Case Study
      1. Results from the Document Gathering Phase
      2. Preliminary List of Data Elements
      3. Tables and Sample Values
        1. Code Tables
        2. Themed Tables
        3. Composite-Key Tables
      4. Airline System Data Schema
      5. Sample Queries
        1. Inserting Sample Values
        2. Boarding Pass
        3. Passenger List
        4. All Persons on a Flight
      6. Summary