CAP theorem
The CAP theorem says a distributed system can only give 2 of 3 characteristics at once: Consistency (everyone sees the same data), Availability (everyone gets an answer) and Partition tolerance (it keeps working even if the network between nodes is cut). It's like a restaurant with 2 branches and the phone line between them down: either they wait to talk so they don't sell the same dish twice, or they keep selling and fix it later.
A CA database gives consistency and availability across all its nodes, but doesn't tolerate partitions: if the network between 2 nodes is cut, it can't keep giving both. So it's not tolerant of network failures. In practice these are databases running in 1 single place, like PostgreSQL or MariaDB on 1 server. It's like a family living in 1 house: everyone hears everything, but it doesn't work across 2 cities.
A CP database gives consistency and partition tolerance at the expense of availability. If the network between 2 nodes is cut, it shuts down the node that can't stay up to date until the network is fixed. That way nobody reads old data, but some requests get no answer. It's like an ATM that, if it loses its connection to the bank, stops giving out cash instead of taking the risk. Examples: MongoDB and Apache HBase.
An AP database gives availability and partition tolerance at the expense of consistency. If the network is cut, all nodes keep answering, but those on the wrong side may return old data. When the network comes back, the database syncs the nodes and fixes the differences. It's like 2 branches that keep selling without talking and balance the till at the end of the day. Examples: Apache Cassandra and CouchDB.
