Choosing the Right Database
There are two main types of Databases. Relational and Non-Relational databases. Choosing the right type is important and depends on what you’re trying to accomplish. The type of data and application being developed are key factors to consider.
A relational Database model is a type of database that stores and provides access to data points that are related to one another. Each row in a relational database table is a record with a unique ID called a key. The columns of the table hold attributes of the data, each attribute usually has a value to accompany it. This makes it easy to create relationships among the data points. Structured query language (SQL) is used with relational databases. Popular examples of relational databases include Microsoft SQL, Oracle Database, MySQL, and IBM DB2. Recently, Cloud-based relational databases have risen in popularity. This is because they enable companies to outsource database maintenance, patching, and infrastructure.
Non-Relational databases (also referred to as NoSQL). These offer mechanisms for storage and retrieval of data that are modeled in other ways different from a tabular format. The data structures include Key-value pairs, wide columns, graphs, or documents. NoSQL databases are also schema-free or have relaxed schemas. Popular NoSQL databases include MongoDB, Apache CouchDB, and Oracle NoSQL Database.
Structured Data vs Unstructured
- Relational databases are normalized. The data is stored in a tabular form, arranged in a table with rows and columns. Whereas, non-relational stores data as files.
- Primary Keys: The tables of relational databases use primary key identifies. In non-relational, the data is sorted in a hierarchical or navigational form without the use of primary keys.
- Data Values Relationships: The relationship between data values is stored in the tables in relational databases. Since a non-relational database stores data as files, there is no relationship between the data values.
- Relational databases use integrity constraints. These ensure integrity and they are defined for atomicity, consistency, isolation, and durability. (ACID)
- Structured vs. unstructured: Relational databases work great for structured data and the predefined data model doesn’t change much. Non-relational databases are better for unstructured data. These include text, email, photos, videos, and web pages.
Say a business is building a database to keep track of customers and orders. One table would be composed of the customer’s information. Their name, address, and so forth. There would also be another table for the order. This table would hold attributes such as the product, data, and sales price. This would be a job for a Relational Database Structure.
Now say A company needs to store text-heavy digital content. Large articles, eBooks, and learning tools are pushed into a single platform. For content-driven applications, the data accessed needs to have low response times. Using a document-based NoSQL database would give the flexibility to store a wide variety of content and provide fast access to it.
In the next part of the series, we are going to dive deeper into Relational Databases. We’ll talk about the different types of relationships with real world examples.