Databases can be organized in different ways by using different models. The data model of a database is the logical structure of the data items and their relationships. There are many database models such as, hierarchical and object-oriented, but relational databases are the most popular types of databases. A relational data model organizes data into inter-related tables. Relational databases are easy to understand and use, and are often contrasted with a flat file database which contains only one file/table, with no relationships. A table created in a spreadsheet would be considered a flat file. Tables and files are terms that are used interchangeably. See an example of a flat file and relational database below. In the relational database example, the data is organized into two separate tables (grades and student) and linked together through a common field. In this case the common field is Student ID.
Difference Between a Database and a Spreadsheet
A database and a spreadsheet can appear to be the same. However, this is a common misconception that extends to the business world as spreadsheets are often used as a substitute for more complex database needs. A spreadsheet stores data in an organized fashion, using rows and columns, and looks like a database table. A spreadsheet can work well if a simple listing of rows and columns (a single table) is all that is needed. For example a listing of students and their information. This is referred to as a flat file database. However, when several types of data must be mixed together, or when the relationships between these types of data are complex, then a spreadsheet is not the optimal solution.
A database allows data from several entities (such as students, courses and grades) to all be related together into one whole. While a spreadsheet does allow you to define what kinds of values can be entered into its cells, a database provides more intuitive and powerful ways to define the types of data that go into each field, reducing possible errors and allowing for easier analysis. Though not good for replacing databases, spreadsheets can be ideal tools for analyzing the data stored in a database. A spreadsheet package can be connected to a specific table or query in a database and used to create charts or perform analysis on that data.
The relational database model is the most used database model today. However, other database models exist with different strengths. The hierarchical database model, popular in the 1960s and 1970s, connected data together in a hierarchy, allowing for a parent/child relationship between data. The document-centric model allowed for a more unstructured data storage by placing data into “documents” that could then be manipulated.
Perhaps the most interesting new development is the concept of NoSQL (from the phrase “not only SQL”). NoSQL allows for large-scale databases to be spread over several servers or even across the world. For a relational database to work properly, it is important that only one person be able to manipulate a piece of data at a time, a concept known as record-locking. But with today’s large-scale databases (think Google and Amazon), this is just not possible. A NoSQL database can work with data in a looser way, allowing for a more unstructured environment, communicating changes to the data over time to all the servers that are part of the database.
The relational database model does not scale well. The term scale here refers to a database getting larger and larger, being distributed on a larger number of computers connected via a network. Some companies are looking to provide large-scale database solutions by moving away from the relational model to other, more flexible models. For example, Google now offers the App Engine Datastore, which is based on NoSQL. Developers can use the App Engine Datastore to develop applications that access data from anywhere in the world. Amazon.com offers several database services for enterprise use, including Amazon RDS, which is a relational database service, and Amazon DynamoDB, a NoSQL enterprise solution.
The next sections focus on the relational model to demonstrate how a database is designed, and the benefits and concerns of use.