DEV Community

Ali Hamza
Ali Hamza

Posted on

Day 84 of Learning MERN Stack

Hello Dev Community! đź‘‹

It is officially Day 84 of my 100-day full-stack and database engineering streak! 🎯 Yesterday, I finalized layout-level structures using DDL commands like ALTER and TRUNCATE. Today, I stepped right into the absolute crown jewel of relational database engine architectures: SQL JOINS, starting with the core workhorse—The INNER JOIN! 🔗📊

In normalized databases, info is split across specialized tables to prevent duplication. However, to display complete profiles on a client interface—like matching user metadata with transactional order history—the backend must unify these datasets seamlessly in a single query pass.


đź§  What is an INNER JOIN? (The Venn Diagram Logic)

Think of an INNER JOIN as a strict intersection filter between two overlapping datasets:

  • It looks at Table A (e.g., student) and Table B (e.g., course).
  • It compares a shared reference pointer (like matching a Primary Key with a Foreign Key).
  • The Result: It extracts rows only if there is a match found across both datasets simultaneously. If a row exists in Table A but has no matching reference pointer in Table B, it is completely omitted from the query readout.

🛠️ Conceptual Operational Blueprint

Here is how I structured my multi-table querying arrays inside my local workspace today to extract common matching datasets fluidly:


sql
-- Querying across multi-linked tables based on unique matching keys
SELECT student.id, student.name, course.course_name 
FROM student 
INNER JOIN course 
ON student.id = course.student_id;
Enter fullscreen mode Exit fullscreen mode

Top comments (0)