Skip to Main Content
Professional Ruby on Rails™
book

Professional Ruby on Rails™

by Noel Rappin
February 2008
Intermediate to advanced content levelIntermediate to advanced
479 pages
14h
English
Wrox
Content preview from Professional Ruby on Rails™

6.5. Why Be Normal?

The database software that most Rails programs use — MySQL, PostgreSQL, and Oracle — all belong to a database structure known as a relational database, in contrast to a flat database, (such as a CSV text file), a hierarchical database (such as an XML structure), or an object-oriented database (such as ... well, nothing you've probably ever heard of, but like the Loch Ness Monster, you do hear about sightings of OO databases from time to time).

6.5.1. A Little Bit of Theory

Although databases may seem like one of the most pragmatic of all software, in fact, there's a huge amount of theory behind the structure and design of relational databases — although, to be fair, a true database purist would argue that none of the popular databases that call themselves relational actually adhere to the strict relational model. Be that as it may, much of the theory of relational database design is concerned with various kinds of normalization. A full discussion of all the various flavors of normalization (Wikipedia lists a solid nine named forms) is beyond the scope of this book (and frankly, I think it may be beyond my humble ability to comprehend).

However, the basic idea behind normalization is simple enough: use the structure of the database to ensure database integrity. In general, this involves keeping unrelated data in separate tables such that data is not duplicated. In your classic Order/Customer database, for example, an un-normalized database might include customer ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Ruby on Rails® Bible

Ruby on Rails® Bible

Timothy Fisher
Rails 4 in Action

Rails 4 in Action

Yehuda Katz, Rebecca Skinner, Stephen Klabnik, Ryan Bigg

Publisher Resources

ISBN: 9780470223888Purchase book