Title,Author,Year
*The Great Gatsby*,F. Scott Fitzgerald,1925
*To Kill a Mockingbird*,Harper Lee,1960
*The Catcher in the Rye*,J.D. Salinger,1951
*The Grapes of Wrath*,John Steinbeck,1939
Examples of Simple Data stores, cont.
Title
Author
Year
The Great Gatsby
F. Scott Fitzgerald
1925
To Kill a Mockingbird
Harper Lee
1960
The Catcher in the Rye
J.D. Salinger
1951
The Grapes of Wrath
John Steinbeck
1939
Examples of Simple Data stores, cont.
[{"title":"The Great Gatsby","author":"F. Scott Fitzgerald","year":1925},{"title":"To Kill a Mockingbird","author":"Harper Lee","year":1960,},{"title":"The Catcher in the Rye","author":"J.D. Salinger","year":1951},{"title":"The Grapes of Wrath","author":"John Steinbeck","year":1939}]
Problems with simple Data stores
Great thing about simple data stores are they are simple files.
But they are not great for:
Searching
Updating
etc.
TLDR: They don’t disaggregate the data.
We cannot combine complicated data.
Problems with simple Data stores, cont.
They show up in many places where they shouldn’t be.
Renault One F1 team used Excel to manage their parts & build data store: 77,000 lines of it.
DO NOT DO THIS!
Too many accidents waiting to happen.
No way to efficiently connect parts to builds without eliminating data.
Enter Databases
Oracle (MySql): “A database is an organized collection of structured data, typically stored electronically in a computer system.”
For this reason, some consider excel as a possible database.
Think of data as individual records of structured information.
Database == Collection of individual records.
CRUD: Create, Read, Update, Delete.
Database vs Excel Spreadsheet
Spreadsheet is a file.
CRUD operations update the file not individual records.
Database: CRUD operations only impact individual records.
Excel spreadsheets filter to show only certain records.
Databases retrieve individual records.
The Filing System—A Paper-Based Database
Types of Databases
Relationsal Databases (SQL)
NoSQL Databases
Document-oriented databases
Graph Databases
Others (Key-Value, column-family, etc.) ← We won’t discuss these.
Relational Databases
SQL: Structured Query Language.
Tables: Rows and Columns.
Rows: Records.
Columns: Fields.
Joins: Combining tables.
Relational database == Collection of tables == Collection of records.
Fundamental rule: do not duplicate data (normalization).
Relational Databases, cont.
Represented similarly as a spreadsheet.
Table of parts:
id
part
company
cost
1
Engine
Renault
1000
2
Tires
Pirelli
500
3
Wings
Red Bull
2000
Relational Databases, Joins tables
MongoDB
NoSQL database.
Document-oriented database.
JSON-like documents (BSON).
No schema.
No joins.
No normalization.
Collections of BSON documents.
Fundamental rule: If it’s queried together, store it together.