O'Reilly logo

Discovering SQL: A Hands-On Guide for Beginners by Alex Kriegel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

3

A Thing You Can Relate To — Designing a Relational Database

You may have heard the term “database model,” but you most definitely have used one. How so? Because one of the database models is a flat file familiar to anyone who ever used computer.

Flat files per se cannot be rightfully called databases as they do not have the properties associated with databases, as we've discussed in Chapter 1, but they are the foundation upon which a relational database management system (RDBMS) is built. They are used to persist the information—both data and metadata — comprising the physical layer; define conventions and structure, add an application that manages these files; and you would end up with a skeleton of a database. If one is to translate a LIBRARY relational data model into a flat file one, the tables could become files — books.txt and authors.txt, for example.

These files would contain a number of records, and an application would read the file sequentially, sifting through records until it found one that matched the search criteria (for a book, for example) and then use information to read through the other file to find the author's information.

Here's an idea: Why not combine these two files into a single file, call it library.txt, and search only one file instead of two? We are back to a bucket of data: one table, one column, one row; dumping everything together would make it harder to read and match the information. The worst thing of all is that every application that will ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required