Differences between SQL and NoSQL databases..
| # | SQL | NoSQL |
|---|---|---|
| 1 | Relational Databases | Distributed Databases |
| 2 | Tables Based | Document Based |
| 3 | Predefined Schema | Dynamic Schema |
| 4 | Not Good at | Good at hierarchical data storage/large data sets |
| 5 | Good at heavy duty transactional type applications | Not as stable |
SQL Use Example:
- Data sets that are optimized for structure that doesn't change frequently, maintains a high level of data integrity/security, routine requirements for complex queries.
- Use case: Transaction oriented systems such as accouting/finance
NoSQL Example:
- data sets are large and unstructured/semi-structured, required flexibility of a dynamic schema, require scaling across systems and locations, expected high traffic, data inconsistency
- Use case: social media, email, docuements.
Video: SQL - Structured Query Language
- relational databases: support SQL language, works with multiple related tables that share a unique id across the combination of tables to build a complete picture of data
- all records need to have the same number of fields (adhere to schema)
- a schema is a requirement for data fields in a table that every piece of data entered must have
- types of relations: many to many, one to one, one to many,
NoSQL - databases that are built to store a large amount of data in an effiecient way without using the SQL langauge.
- they contain collections instead of tables.
- each collection has a document that looks like JSON
- they don't have to use the same schema (AKA can have different fields)
- MongoDB is more flexible than trantional SQL databases because there is no schema or requirement for how the data looks
- no relations, just collections and documents, so put all of the information in one place that you would need
- Disadvantage: you have duplicate data that needs to be updated in multiple spots because of the lack of relationships
- How do you balance the need for structure/reliablity for the need scale, for example a financial application that needs to scale widely.