{"id":5080,"date":"2026-01-12T06:00:18","date_gmt":"2026-01-12T06:00:18","guid":{"rendered":"https:\/\/w3buddy.com\/?post_type=cposts&#038;p=5080"},"modified":"2026-01-12T06:00:20","modified_gmt":"2026-01-12T06:00:20","slug":"relational-database-concepts","status":"publish","type":"cposts","link":"https:\/\/w3buddy.com\/blog\/notes\/getting-started-with-oracle-dba\/relational-database-concepts\/","title":{"rendered":"Relational Database Concepts"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Back in 1970, an IBM researcher named Edgar F. Codd published a paper that changed everything. He proposed organizing data using mathematical set theory instead of the hierarchical and network models everyone was using. People thought he was crazy. Today, his relational model powers most of the world&#8217;s critical systems.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let me show you why this matters for your daily work as a DBA.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What Is a Relational Database?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A <strong>relational database<\/strong> stores data in tables (called relations) where:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Each table represents one type of entity (customers, orders, products)<\/li>\n\n\n\n<li>Rows contain individual records<\/li>\n\n\n\n<li>Columns contain attributes<\/li>\n\n\n\n<li>Tables connect through relationships using keys<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Simple example:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CUSTOMERS Table\ncustomer_id | name        | email\n101         | John Smith  | john@email.com\n102         | Jane Doe    | jane@email.com\n\nORDERS Table\norder_id | customer_id | amount\n1001     | 101         | 500\n1002     | 101         | 750\n1003     | 102         | 300<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>customer_id<\/code> links these tables\u2014that&#8217;s the &#8220;relational&#8221; part.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Core Concepts You Must Know<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. Tables (Relations)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A table is a collection of related data organized in rows and columns.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Key rules:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Each table has a unique name<\/li>\n\n\n\n<li>Column names must be unique within the table<\/li>\n\n\n\n<li>All values in a column must be of the same data type<\/li>\n\n\n\n<li>Order of rows doesn&#8217;t matter (it&#8217;s a set, not a list)<\/li>\n\n\n\n<li>Each row should be uniquely identifiable<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2. Primary Keys<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A <strong>primary key<\/strong> uniquely identifies each row in a table.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sql<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE TABLE employees (\n    employee_id NUMBER PRIMARY KEY,  <em>-- This is the primary key<\/em>\n    name VARCHAR2(100),\n    email VARCHAR2(100)\n);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Rules:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Must be unique<\/li>\n\n\n\n<li>Cannot be NULL<\/li>\n\n\n\n<li>Should be immutable (never changes)<\/li>\n\n\n\n<li>Can be a single column or multiple columns (composite key)<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Common mistake:<\/strong> Using email as a primary key. What if someone changes their email? Use an ID instead.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>\ud83d\udca1 Interview Insight:<\/strong> &#8220;Why not use email as a primary key?&#8221; Answer: Emails can change, may not be unique in all contexts, and are longer to index than numeric IDs. Primary keys should be stable and efficient.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">3. Foreign Keys<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A <strong>foreign key<\/strong> creates relationships between tables by referencing another table&#8217;s primary key.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE TABLE orders (\n    order_id NUMBER PRIMARY KEY,\n    customer_id NUMBER,\n    amount NUMBER,\n    FOREIGN KEY (customer_id) REFERENCES customers(customer_id)\n);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>What this enforces:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Can&#8217;t create an order for a non-existent customer<\/li>\n\n\n\n<li>Can&#8217;t delete a customer who has orders (unless you configure CASCADE)<\/li>\n\n\n\n<li>Maintains referential integrity automatically<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">This is <strong>referential integrity<\/strong>\u2014one of the most powerful features of relational databases.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. Relationships Between Tables<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Three types of relationships exist:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>One-to-One (1:1)<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>One employee has one employee badge<\/li>\n\n\n\n<li>Rare in practice, often combined into one table<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>One-to-Many (1:M)<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>One customer has many orders<\/li>\n\n\n\n<li>Most common relationship type<\/li>\n\n\n\n<li>Implemented with foreign key in the &#8220;many&#8221; table<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Many-to-Many (M:M)<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>One student enrolls in many courses<\/li>\n\n\n\n<li>One course has many students<\/li>\n\n\n\n<li>Requires a junction table (enrollment table linking students and courses)<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">sql<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em>-- Junction table for many-to-many<\/em>\nCREATE TABLE enrollments (\n    student_id NUMBER,\n    course_id NUMBER,\n    enrollment_date DATE,\n    PRIMARY KEY (student_id, course_id),\n    FOREIGN KEY (student_id) REFERENCES students(student_id),\n    FOREIGN KEY (course_id) REFERENCES courses(course_id)\n);\n```\n\n### 5. Normalization\n\n**Normalization** is the process of organizing data to reduce redundancy and improve integrity.\n\n**Example of poor design (unnormalized):**\n```\nORDERS Table\norder_id | customer_name | customer_email | customer_phone | product | price\n1001     | John Smith    | john@email.com | 555-1234       | Laptop  | 1200\n1002     | John Smith    | john@email.com | 555-1234       | Mouse   | 25\n```\n\n**Problems:**\n- Customer info repeated for every order\n- If John changes his email, must update multiple rows\n- Wasted storage space\n\n**After normalization:**\n```\nCUSTOMERS Table\ncustomer_id | name       | email          | phone\n101         | John Smith | john@email.com | 555-1234\n\nORDERS Table\norder_id | customer_id | product | price\n1001     | 101         | Laptop  | 1200\n1002     | 101         | Mouse   | 25<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Benefits:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Customer info stored once<\/li>\n\n\n\n<li>Updates happen in one place<\/li>\n\n\n\n<li>Less storage, fewer errors<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Normal Forms (Quick Overview)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1NF (First Normal Form):<\/strong> Each column contains atomic values (no lists or arrays)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2NF (Second Normal Form):<\/strong> 1NF + no partial dependencies (all non-key columns depend on entire primary key)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3NF (Third Normal Form):<\/strong> 2NF + no transitive dependencies (non-key columns don&#8217;t depend on other non-key columns)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>BCNF (Boyce-Codd Normal Form):<\/strong> Stricter version of 3NF<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Most production databases target 3NF, then denormalize selectively for performance.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>\ud83d\udca1 Interview Insight:<\/strong> &#8220;When would you denormalize?&#8221; Answer: For read-heavy workloads, reporting tables, or when join performance becomes a bottleneck. Always denormalize intentionally, not accidentally.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">6. Integrity Constraints<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Constraints maintain data quality and enforce business rules.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Types of constraints:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE TABLE employees (\n    employee_id NUMBER PRIMARY KEY,              <em>-- Entity integrity<\/em>\n    department_id NUMBER NOT NULL,               <em>-- Domain integrity<\/em>\n    email VARCHAR2(100) UNIQUE,                  <em>-- Uniqueness<\/em>\n    salary NUMBER CHECK (salary &gt; 0),            <em>-- Domain integrity<\/em>\n    hire_date DATE DEFAULT SYSDATE,              <em>-- Default value<\/em>\n    FOREIGN KEY (department_id)                  <em>-- Referential integrity<\/em>\n        REFERENCES departments(department_id)\n);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Entity Integrity:<\/strong> Primary key must be unique and NOT NULL<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Domain Integrity:<\/strong> Values must be valid for the data type and within acceptable ranges<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Referential Integrity:<\/strong> Foreign keys must reference existing primary keys<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>User-Defined Integrity:<\/strong> Custom business rules (CHECK constraints, triggers)<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">7. ACID Properties in Relational Context<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Relational databases guarantee ACID properties for transactions:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Atomicity:<\/strong> Transaction succeeds completely or fails completely<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>BEGIN TRANSACTION;\n  UPDATE accounts SET balance = balance - 100 WHERE id = 1;\n  UPDATE accounts SET balance = balance + 100 WHERE id = 2;\nCOMMIT;  <em>-- Both updates succeed or both rollback<\/em><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Consistency:<\/strong> Database moves from one valid state to another (all constraints satisfied)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Isolation:<\/strong> Concurrent transactions don&#8217;t interfere with each other<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Durability:<\/strong> Committed changes survive system failures<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">These guarantees make relational databases ideal for financial systems, e-commerce, and any application where data accuracy is critical.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SQL: The Language of Relational Databases<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Structured Query Language (SQL)<\/strong> is the standard language for interacting with relational databases.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Key SQL categories:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>DDL (Data Definition Language):<\/strong> Define structure<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE TABLE, ALTER TABLE, DROP TABLE<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>DML (Data Manipulation Language):<\/strong> Manipulate data<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT, INSERT, UPDATE, DELETE<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>DCL (Data Control Language):<\/strong> Control access<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GRANT, REVOKE<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>TCL (Transaction Control Language):<\/strong> Manage transactions<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>COMMIT, ROLLBACK, SAVEPOINT<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">SQL is declarative\u2014you specify <em>what<\/em> you want, not <em>how<\/em> to get it. The DBMS figures out the optimal execution path.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Relational Operations<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The relational model is built on set theory operations:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>SELECT:<\/strong> Filter rows based on conditions (\u03c3)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT * FROM employees WHERE salary &gt; 50000;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>PROJECT:<\/strong> Choose specific columns (\u03c0)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT name, email FROM employees;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>JOIN:<\/strong> Combine related tables<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT e.name, d.department_name\nFROM employees e\nJOIN departments d ON e.department_id = d.department_id;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>UNION:<\/strong> Combine results from multiple queries (must have same columns)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT name FROM employees_2023\nUNION\nSELECT name FROM employees_2024;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>INTERSECT:<\/strong> Find common rows between queries<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>MINUS (or EXCEPT):<\/strong> Find rows in first query but not in second<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">These operations follow mathematical set theory, which is why they&#8217;re reliable and predictable.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Indexes: Performance Accelerators<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Indexes<\/strong> are separate data structures that speed up data retrieval.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE INDEX idx_emp_dept ON employees(department_id);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>How indexes work:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Like a book&#8217;s index\u2014jump directly to relevant pages instead of reading everything<\/li>\n\n\n\n<li>Typically implemented as B-tree structures<\/li>\n\n\n\n<li>Trade-off: Faster reads, slower writes (index must be updated)<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>When to use indexes:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Columns used in WHERE clauses<\/li>\n\n\n\n<li>Columns used in JOIN conditions<\/li>\n\n\n\n<li>Columns used in ORDER BY<\/li>\n\n\n\n<li>Foreign key columns<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>When NOT to use indexes:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Small tables (full scan is faster)<\/li>\n\n\n\n<li>Columns with low selectivity (many duplicate values)<\/li>\n\n\n\n<li>Tables with heavy INSERT\/UPDATE activity<\/li>\n<\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>\ud83d\udca1 Interview Insight:<\/strong> &#8220;How do you decide what to index?&#8221; Answer: Analyze query patterns, examine execution plans, index columns in WHERE\/JOIN clauses, but avoid over-indexing. Monitor index usage and drop unused indexes.<\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">Views: Virtual Tables<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Views<\/strong> are saved queries that act like tables.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE VIEW active_employees AS\nSELECT employee_id, name, email\nFROM employees\nWHERE status = 'ACTIVE';\n\n<em>-- Use it like a table<\/em>\nSELECT * FROM active_employees WHERE name LIKE 'J%';<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Benefits:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Simplify complex queries<\/li>\n\n\n\n<li>Provide security (users see only specific columns\/rows)<\/li>\n\n\n\n<li>Abstract underlying schema changes<\/li>\n\n\n\n<li>No data duplication (it&#8217;s just a stored query)<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Why Relational Databases Dominate<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">After 50+ years, the relational model remains dominant because:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Mathematical foundation:<\/strong> Based on solid set theory and relational algebra<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Data integrity:<\/strong> Constraints and ACID properties prevent data corruption<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Flexibility:<\/strong> SQL lets you ask questions not anticipated during design<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Standardization:<\/strong> SQL is (mostly) standardized across different RDBMS<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Maturity:<\/strong> Decades of optimization and tooling<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Universal understanding:<\/strong> Most developers\/DBAs know relational concepts<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Yes, NoSQL databases have their place, but for structured data requiring consistency and complex queries, relational databases are still the gold standard.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Relational vs Other Models<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Relational:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Data in tables with relationships<\/li>\n\n\n\n<li>Schema defined upfront<\/li>\n\n\n\n<li>ACID guarantees<\/li>\n\n\n\n<li>SQL for queries<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Document (MongoDB):<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Data in JSON-like documents<\/li>\n\n\n\n<li>Flexible schema<\/li>\n\n\n\n<li>Eventual consistency<\/li>\n\n\n\n<li>Query language varies<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Key-Value (Redis):<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Simple key-value pairs<\/li>\n\n\n\n<li>Very fast, very simple<\/li>\n\n\n\n<li>No complex queries<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Graph (Neo4j):<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Nodes and relationships<\/li>\n\n\n\n<li>Optimized for connected data<\/li>\n\n\n\n<li>Specialized query language<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Choose relational when:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Data has clear structure and relationships<\/li>\n\n\n\n<li>Consistency is critical<\/li>\n\n\n\n<li>Complex queries are needed<\/li>\n\n\n\n<li>Multiple access patterns required<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Practical Example: E-commerce Database<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Let me show you a real-world relational schema:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em>-- Core entities<\/em>\nCREATE TABLE customers (\n    customer_id NUMBER PRIMARY KEY,\n    email VARCHAR2(100) UNIQUE NOT NULL,\n    name VARCHAR2(100) NOT NULL,\n    created_date DATE DEFAULT SYSDATE\n);\n\nCREATE TABLE products (\n    product_id NUMBER PRIMARY KEY,\n    name VARCHAR2(200) NOT NULL,\n    price NUMBER(10,2) CHECK (price &gt; 0),\n    stock_quantity NUMBER DEFAULT 0\n);\n\nCREATE TABLE orders (\n    order_id NUMBER PRIMARY KEY,\n    customer_id NUMBER NOT NULL,\n    order_date DATE DEFAULT SYSDATE,\n    status VARCHAR2(20) CHECK (status IN ('PENDING','SHIPPED','DELIVERED')),\n    FOREIGN KEY (customer_id) REFERENCES customers(customer_id)\n);\n\nCREATE TABLE order_items (\n    order_id NUMBER,\n    product_id NUMBER,\n    quantity NUMBER CHECK (quantity &gt; 0),\n    price_at_purchase NUMBER(10,2),\n    PRIMARY KEY (order_id, product_id),\n    FOREIGN KEY (order_id) REFERENCES orders(order_id),\n    FOREIGN KEY (product_id) REFERENCES products(product_id)\n);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>This design ensures:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>No customer can be deleted if they have orders<\/li>\n\n\n\n<li>No product prices become negative<\/li>\n\n\n\n<li>Order status is always valid<\/li>\n\n\n\n<li>Quantity is always positive<\/li>\n\n\n\n<li>Price at purchase is preserved (even if product price changes later)<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">That&#8217;s the power of relational design with proper constraints.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Coming up next:<\/strong> We&#8217;ll explore <strong>Types of Databases<\/strong> and understand when to use relational vs non-relational databases, helping you make informed architecture decisions.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Back in 1970, an IBM researcher named Edgar F. Codd published a paper that changed everything. He proposed organizing data using mathematical set theory instead of the hierarchical and network models everyone was using. People thought he was crazy. Today, his relational model powers most of the world&#8217;s critical systems. Let me show you why [&hellip;]<\/p>\n","protected":false},"template":"","meta":{"googlesitekit_rrm_CAowu461DA:productID":""},"categories":[960,952],"class_list":["post-5080","cposts","type-cposts","status-publish","hentry","category-getting-started-with-oracle-dba","category-notes"],"_links":{"self":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/cposts\/5080","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/cposts"}],"about":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/types\/cposts"}],"wp:attachment":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/media?parent=5080"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/categories?post=5080"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}