A Logical Guide to Outsourcing Relational Databases · Table of Contents Introduction ..... 6

6

Transcript of A Logical Guide to Outsourcing Relational Databases · Table of Contents Introduction ..... 6

Page 1: A Logical Guide to Outsourcing Relational Databases · Table of Contents Introduction ..... 6
Page 2: A Logical Guide to Outsourcing Relational Databases · Table of Contents Introduction ..... 6

A Logical Guide to Outsourcing Relational Databases Outsource That

Copyright © Steven Brough | All Rights Reserved.

1

A Logical Guide to Outsourcing Relational

Databases By Steven Brough

Page 3: A Logical Guide to Outsourcing Relational Databases · Table of Contents Introduction ..... 6

A Logical Guide to Outsourcing Relational Databases Outsource That

Copyright © Steven Brough | All Rights Reserved.

3

Table of Contents Introduction ............................................................................................................................. 6

1 | What is a Database? ......................................................................................................... 7

Relational Databases ....................................................................................................................7

Fields...................................................................................................................................................... 9

Records .............................................................................................................................................. 10

2 | Relationships in Databases ......................................................................................... 13

One-to-One Relationships ...................................................................................................... 14

One-to-Many / Many-to-One Relationships ................................................................... 15

Many-to-Many Relationships ................................................................................................ 17

Self-Referencing Relationships ............................................................................................. 19

Foreign Keys ................................................................................................................................. 20

Defining Foreign Keys Explicitly ................................................................................................. 21

Defining Foreign Keys Without Explicit Declaration ........................................................... 22

3 | Designing a Database: An Example........................................................................... 22

Step 1: Identify the Entities in Your Application ............................................................ 23

Step 2: List the Entity Relationships ................................................................................... 24

Step 3: Identify Cardinalities.................................................................................................. 25

Step 4: Define Modules ............................................................................................................ 27

4 | Normalization ................................................................................................................. 28

Page 4: A Logical Guide to Outsourcing Relational Databases · Table of Contents Introduction ..... 6

A Logical Guide to Outsourcing Relational Databases Outsource That

Copyright © Steven Brough | All Rights Reserved.

4

First Normal Form ...................................................................................................................... 28

Second Normal Form ................................................................................................................. 31

Third Normal Form..................................................................................................................... 32

5 | Queries .............................................................................................................................. 35

Introduction to SQL ................................................................................................................... 38

SELECT ............................................................................................................................................... 39

FROM ................................................................................................................................................. 39

WHERE .............................................................................................................................................. 40

Modifying Tables with SQL Commands ............................................................................ 40

INSERT INTO ................................................................................................................................... 40

DELETE FROM ................................................................................................................................ 41

Other SQL Commands .................................................................................................................. 42

Application Performance and SQL ...................................................................................... 45

6 | Writing Simple SQL Queries ....................................................................................... 46

Database Hierarchy ................................................................................................................... 46

Simple Queries ............................................................................................................................. 47

AND .................................................................................................................................................... 47

ORDER BY and GROUP BY ......................................................................................................... 48

LIMIT .................................................................................................................................................. 50

The “*” ................................................................................................................................................. 50

COUNT .............................................................................................................................................. 51

Page 5: A Logical Guide to Outsourcing Relational Databases · Table of Contents Introduction ..... 6

A Logical Guide to Outsourcing Relational Databases Outsource That

Copyright © Steven Brough | All Rights Reserved.

5

JOIN .................................................................................................................................................... 52

7 | Security ............................................................................................................................. 54

8 | Backup and Duplication ............................................................................................... 56

9 | Outsourcing Your Database Development ............................................................ 58

Which Type of Database? ........................................................................................................ 58

Single-User Application (Local Database) ............................................................................... 58

Service-Based Database ............................................................................................................... 58

Web-Based Server .......................................................................................................................... 59

Which Information? ................................................................................................................... 60

10 | Finding the Best-Suited Freelancer ........................................................................ 62

Preparing a Project Description ........................................................................................... 62

Screening Applicants ................................................................................................................. 63

Documentation ............................................................................................................................ 64

Selecting a Back-End and Front-End .................................................................................. 64

Communicating with Your Selected Provider ................................................................ 65

Implementing the Final System ............................................................................................. 66

Conclusion ............................................................................................................................. 68

Page 6: A Logical Guide to Outsourcing Relational Databases · Table of Contents Introduction ..... 6

A Logical Guide to Outsourcing Relational Databases Outsource That

Copyright © Steven Brough | All Rights Reserved.

6

Introduction

This document is written for people who want to design and create a dynamic

website or software program that requires a database in its back-end. You might

have different degrees of understanding about this type of development. This

particular book focuses on the premise that when designing your program, a simple

understanding of how the database is structured will help you figure out what you

can and can’t do.

This document is written for people who are unfamiliar with database function and

design. It’s meant to give an overview of the architecture and mechanisms used in

their creation, illustrating key concepts with two examples: an independent hotel

and an e-Commerce website. It also offers a glimpse into the many ways that a well-

thought-out database can benefit everyone, from home users to multi-national

companies.

Having a system designed specifically for your needs will ensure that it is easily

maintained, has the relevant information available, and remains affordable thanks to

professional help available from freelance sources. To do this, the owner should have

insight into the way it works, the type of information required to fill the database,

and most importantly from the user’s point of view, the type and format of the

information being retrieved. This is exactly what this guide will help you do.