SQL, NOSQL databases Flashcards
What are 7 advantages of using SQL
- Relational data model (tables of data that are organised and related based on PK and FK relationships, nomalisation is used for tables 1NF, 2NF, 3NF, 4NF)
- Strong data integrity (constraints on the data means it is consistent, ACID)
- Retrieve and manipulate data in different ways
- Widely used and supported - many resources available
- Can be scaled up to handle large data sets and designed to work well in high-performance environments
- Long history of development, deployment and security so it is robust and secure
What are 6 disadvantages of SQL
- Can be expensive to implement, maintain and scale (extra hardware)
- Performance declines as data grows
- Rigid data structure makes it difficult to accommodate changing requirements
- Queries can be complex and difficult to write
- Doesn’t support unstructured data ie., graphs, images, videos
- Security concerns ie., injection attacks
What are the advantages of NOSQL
- Scalable and able to process large amounts of unstructured or semi-structured data
- Flexible because it can be easily changed without having to change the underlying schema
- Fast read and write performance
- Typically cheaper than relational databases because don’t require complex set up and hardware
What are the cons of NOSQL?
- Unstructured making it difficult design, implement and maintain consistency across data
- Can be complex to scale
- Doesn’t support transactions so difficult to guarantee consistency
- No structures like joins and foreign keys can make it difficult to work with complex data structures and queries
What is a database
A database is permanent storage
What is a cache?
A cache remembers the result of an expensive operation to speed up rears
What is batch processing?
Batch processing is periodically crunching a large amount of data
Give an example of a NOSQL database
MongoDB is a no sql database that supports scaling out across regions and across multiple servers
Describe 3 features of NOSQL databases
Flexible schemas
Unstructured
Fast queries due to the data model
What are 2 main types of NOSQL databases?
Document databases
Graph databases
What is a document database?
A document database stores objects similar to JSON objects.
Each document contains pairs of fields and values.
What are graph databases?
A graph database stores data in nodes and edges
What is a DDL?
Data definition language (DDL) describes the portion of SQL that creates, alters, and deletes database objects.
What is a DML?
A data manipulation language (DML) is a computer programming language used for adding (inserting), deleting, and modifying (updating) data in a database.
What are database design principles?
ACID
atomicity - if one part fails, all fails
consistency - data integrity
isolation - not changed by another transaction
durability - changes persisted permenantly