• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 1. About Databases > Flat-File vs. Relational

Flat-File vs. Relational

You can build two types of databases in most modern database programs: flat file and relational. In a flat-file database, all necessary fields are defined in a single file or table. A relational database, on the other hand, is composed of multiple files or tables, related to one another by matching key fields in the files or tables. The main advantage of a relational database is that it avoids unnecessary data duplication. Rather than retyping the same information in every record that requires it (such as a student’s address), the data can simply be displayed by referencing the table in which it’s stored.

For example, an invoicing database might have three tables: Invoices, Customers, and Products. A relationship could be defined between Invoices and the Customers table, based on a Customer ID field. Another relationship could be defined between Invoices and Products, based on a Product ID field. When you create a new invoice and enter a Customer ID, the matching ID in the Customers table is found, enabling the customer’s address information to instantly be displayed in the invoice. When you enter a Product ID, the Products table is consulted and the information for that item is displayed. If you have repeat customers and products that you sell to many people, you’ll save an enormous amount of time by only having to enter IDs in each invoice—rather than retyping data that’s already stored in the Customers and Products tables.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint