Database Management Systems (DBMS)
- NoSQL is a class of DBMs that are non-relational and generally do not use SQL.
- It allows representation of alternative structures, encouraging greater flexibility.
- NoSQL lacks the standard interface which SQL provides, so more complex queries can be difficult to execute.
- i.e. mongoDB, cassandra, DynamoDB, Apache CouchDB, Redis, InfinityDB, MariaDB, Scylla, ArangoDB, InfiniteGraph, Neo4j, etc.
- It is preferred for
- graph or hierarchical data.
- data sets which are both large and mutate significantly.
- businesses growing extremely fast, but lacking data schemata.
- It can be scalled vertically, by increasing the power of existing hardware.
- NoSQL databases need not stick to a strict format, but generally fit into one of four broad categories:
- Column-oriented DBs transpose row-oriented RDBMSs, allowing efficient storage of high-dimensional data and individual records with varying attributes.
- Key-Value stores are dictionaries which access diverse objects with a key unique to each.
- Document stores hold semi-structured data: objects which contain all of their own relevant information, and which can be completely different from each other.
- Graph databases add the concept of relationships (direct links between objects) to documents, allowing rapid traversal of greatly connected data sets.
- NoSQL technologies adhere to the “CAP” theorem, which says that in any distributed database, only two of the following properties can be guaranteed at once:
- Consistency: Every request receives the most recent result, or an error. (Note this is different than in ACID)
- Availability: Every request has a non-error result, regardless of how recent that result is.
- Partition tolerance: Any delays or losses between nodes will not interrupt the system’s operation.
- SQL is the PL used to interface with relational DBs.
- Declarative (Bildirimsel)
- It is particularly well-suited for complex queries.
- It is preferred when the data is
- conceptually modelled as tabular.
- in systems where consistency is critical.
- It uses a master-slave architecture so
- It can be scaled by adding more power to the current machines.
- SQL database schemata always represent relational, tabular data, with rules about consistency and integrity. They contain tables with columns (attributes) and rows (records), and keys have constrained logical relationships.
- RDBMSs must exhibit four “ACID” properties:
- Atomicity means all transactions must succeed or fail completely. They cannot be partially-complete, even in the case of system failure.
- Consistency means that at each step the database follows invariants: rules which validate and prevent corruption.
- Isolation prevents concurrent transactions from affecting each other. Transactions must result in the same final state as if they were run sequentially, even if they were run in parallel.
- Durability makes transactions final. Even system failure cannot roll-back the effects of a successful transaction.
2.1. Relational DBMS
CRUD := CREATE READ UPDATE DELETE
i.e. PostgreSQL: An object-relational DBMS
brew install postgresql brew services start postgresql brew services stop postgresql brew postgresql-upgrade-database
- pgADMIN (GUI)
- pgADMIN (GUI)