Relational Database
Primary keys prevent duplication, foreign keys enforce referential integrity and normal form rules prevent anomalies.
Data is always consistent. However performance issues may occur if it is too big and there may be wasted space.
Graph Databases
Viewing data as a mathematical graph; relationships between data are key but they do not always need to have the same values. Often used in social networking
Advantages of Graph Databases
Disadvantages of Graph Databases
- No uniform query language
Column Stores
Column stores have tables like relational databases however the data is stored in column rather than rows e.g.
Column 1: (‘Jason’, ‘Steve’)
Column 2: (‘Steggles’, ‘Riddle’)
Advantages/Disadvantages of Column Stores
Performance of searching for a specific column is much faster BUT for a specific row is much slower
Hashing
Key-Value stores are based on hashing. Applying a hash function to a key to determine where each piece of data is stored in memory
Keys
Keys are the raw data which has a hashing function applied to
Values
Values can be anything - different databases permit different data types. stored in the key
Advantages of Key-Value stores
Disadvantages of Key-Value stores
Document Databases
Self contained - each document might have different numbers of fields and different fields to other documents.
Similar to key-value stores where there are keys, usually a text string. Document can be queried to return certain parts of it.
Representation of Document Databases
Documents might be in a variety of formats, e.g JSON, XML, PDF
Documents are similar to objects in object oriented programming
Basic operations are permitted (CRUD)
Advantages of document databases
Disadvantages of document databases
MongoDB
Stores documents in a similar format to JSON with key-value pairs
Uses the concept of Collection which is a collection of documents
Collections
Collections store records, which are referred to as documents. Collections are the equivalent of tables in RDBMS, and documents can be thought of as rows in a table. The difference is that you don’t define what columns (or rather attributes) there will be in advance.