What are SQL databases?
They are relational databases that use a structured query language (SQL) to work with the data.
How do SQL databases work?
Data is structured in tables consisting of rows and columns. Tables can have relationships with other tables. They also have well defined schemas.
What are some key features of SQL databases?
ACID compliance to ensure reliable transactions, structured data (via schema along with rows/columns/tables), and a robust query language.
What are some examples of SQL databases?
Microsoft SQL Server, Postgres, MySQL, Oracle.
What is a popular use-case for a SQL database?
Any systems requiring very strong consistency guarantees like banking/financial and systems where the schema/structure of the data seldom changes.
What are NoSQL databases?
NoSQL databases are non-relational or distributed databases. They can handle non-relational or unstructured data using a variety of different data models.
What are some examples of NoSQL data models?
Key-value, document, columnar (wide-column), graph, etc.
How do NoSQL databases work?
They do not require a fixed schema and support schema changes at any time. Many are designed to scale out across clusters (perfect for large or cloud workloads).
What are some features of NoSQL databases?
Speed (no hard consistency guarantees or latency), flexibility (no fixed schema), scalability (designed to scale out)
What are some examples of flavors of NoSQL databases?
Key-value - Redis, Memcached
Document - Mongo
Columnar - Cassandra
Graph - Neo4J
What are NoSQL databases best for?
Systems that require flexibility and/or scale.
How do SQL and NoSQL differ in regards to: data structures, scaling, transactions, and complexity?
Data Structures
SQL is very structured with a required rigid schema, NoSQL is flexible.
Scaling
SQL scales vertically while NoSQL scales horizontally.
Transactions
SQL has robust transaction support while NoSQL support is limited.
Complexity
SQL excels with complexity queries while NoSQL generally focuses on simplicity and speed.
When should you choose SQL over NoSQL and vice versa?
Choose SQL when… you have a well defined or unchanging schema and require strong consistency guarantees like ACID.
Chose NoSQL when… you need flexibility or require extreme scale.