Oracle Database
SQL vs NoSQL Databases
Not every data problem needs the same solution. Two main types of databases exist today — SQL databases and NoSQL databases. Knowing the difference helps you understand why Oracle is chosen for some systems and why a different database might be chosen for others. This lesson explains both types clearly, compares them honestly, and helps you recognise which one fits which situation.
What Is a SQL Database?
A SQL database is a relational database. It stores data in tables — rows and columns — with a fixed structure. Every row in a table follows the same format. Relationships between tables are defined using keys. You query the data using SQL (Structured Query Language).
Oracle is a SQL database. So are MySQL, PostgreSQL, and Microsoft SQL Server. They all share the same core idea: structured tables, defined relationships, and a consistent query language.
SQL databases are built around four guarantees known as ACID:
- Atomicity — a transaction either fully completes or fully rolls back. No half-finished changes.
- Consistency — the database always moves from one valid state to another. Rules and constraints are always enforced.
- Isolation — two transactions running at the same time do not interfere with each other.
- Durability — once a transaction is committed, it is permanent even if the server crashes.
These guarantees are why banks, hospitals, governments, and enterprises trust Oracle with their most critical data.
What Is a NoSQL Database?
NoSQL stands for Not Only SQL. It does not mean "no SQL at all" — it means a broader family of databases that do not follow the traditional table-and-row structure. NoSQL databases were created to handle problems that relational databases were not originally designed for: massive scale, variable data structures, and extremely fast single-record access.
There are four main types of NoSQL databases:
- Document stores — store data as JSON or XML documents. Each document can have a different structure. Best for product catalogues, user profiles, and content management. Examples: MongoDB, CouchDB.
- Key-value stores — store data as a simple key paired with a value. Extremely fast for lookups. Best for session caches, shopping carts, and real-time counters. Examples: Redis, DynamoDB.
- Column-family stores — organise data by column rather than row. Best for time-series data, IoT sensor readings, and write-heavy workloads at massive scale. Examples: Apache Cassandra, HBase.
- Graph databases — store data as nodes and edges (relationships). Best for social networks, recommendation engines, and fraud detection where connections between records matter as much as the records themselves. Examples: Neo4j, Amazon Neptune.
Key Differences Side by Side
| Dimension | SQL (Oracle) | NoSQL |
|---|---|---|
| Data structure | Tables with fixed columns and rows | Documents, key-value pairs, columns, or graphs |
| Schema | Fixed — enforced before data is written | Flexible — structure can vary per record |
| Transactions | Full ACID guarantees | Usually eventual consistency (BASE) |
| Relationships | Enforced by foreign keys and joins | Handled by the application, not the database |
| Scaling | Primarily vertical (more powerful server) | Horizontal (more servers added as needed) |
| Query language | SQL — standardised across all relational databases | System-specific — varies by database type |
| Best for | Finance, HR, healthcare, ERP, regulated industries | Caching, social feeds, IoT, variable-schema content |
When to Use Each
Choose Oracle (SQL) when:
- Your data has clear relationships — customers have orders, employees have salaries, orders have payments
- Data accuracy is non-negotiable — financial records, medical data, payroll
- You need complex queries that join multiple tables together
- Regulatory compliance requires auditable, consistent data
Choose NoSQL when:
- Your data structure varies per record — different product types with different attributes
- You need to store and retrieve billions of records at very high speed
- Your primary access pattern is always "give me the record with this ID" rather than complex joins
- You are building something like a real-time chat, a session cache, or a social activity feed
Many large systems use both. Oracle handles the core transactional data — orders, payments, employee records — while a NoSQL store handles caching, sessions, or unstructured content. This approach is called polyglot persistence and it is common in production at scale.
For this course, both the DataplexaStore and DataplexaHR schemas are relational workloads. Orders reference customers. Order items reference products. Salaries reference employees and jobs. These relationships, combined with the need for transactional accuracy, make Oracle the correct choice for both.
Summary
| Term | Meaning | Example |
|---|---|---|
| SQL database | Relational — tables, fixed schema, SQL queries | Oracle, MySQL, PostgreSQL |
| NoSQL database | Non-relational — flexible structure, varied models | MongoDB, Redis, Cassandra, Neo4j |
| ACID | Transaction guarantees in SQL databases | Oracle enforces all four |
| BASE | Eventual consistency model in most NoSQL databases | Cassandra, DynamoDB |
| CAP theorem | A distributed system can guarantee only 2 of: Consistency, Availability, Partition tolerance | Oracle chooses consistency |
| Polyglot persistence | Using more than one database type in the same system | Oracle for orders + Redis for sessions |
Practice Questions
Practice 1. What does NoSQL stand for and what does it mean in plain terms?
Practice 2. List the four types of NoSQL databases and describe what each is best used for.
Practice 3. What is the difference between ACID and BASE?
Practice 4. What is polyglot persistence? Give a practical example.
Practice 5. Why are the DataplexaStore and DataplexaHR schemas better suited to Oracle than a NoSQL database?
Quiz
Quiz 1. Which NoSQL database type would you use to store session data that needs to be retrieved by a single unique session ID at very high speed?
Quiz 2. What does BASE stand for?
Quiz 3. The CAP theorem states a distributed system can guarantee at most how many of its three properties at once?
Quiz 4. Which of the following is the strongest reason to choose Oracle over a NoSQL database for a payroll system?
Quiz 5. What is polyglot persistence?
Next up — What is Oracle Database — Explore what makes Oracle different from other relational databases, understand its core components, and learn the key terminology you will use throughout this course.