join
Combining rows from two tables into one result by pairing rows according to a rule, usually matching keys.
In more detail
JOIN names the second table and ON states the pairing rule, typically that a foreign key equals a primary key. The result has one row per matching pair, so a customer with two orders appears twice. Normalisation splits data into tables; joins put it back together.
Examples
Joins are the usual cure for the N+1 query problem.Correlation rules are joins: each successful login joined to the failed logins from the same address in the ten minutes before it, then grouped and counted.FROM orders JOIN customers ON customers.id = orders.customer_idRelated terms
- SQL — The standard language for defining, querying and changing data in a relational database.
- N+1 query problem — A performance bug where code runs one query for a list and then one more query per item, so N items cost N+1 queries.
- table — A named set of rows that all have the same columns, where each row records one fact about one thing.
- correlation rule — A detection rule that links several events, often from different sources, that together suggest an attack.
- inner join — A join that keeps only the pairs of rows that satisfy the ON rule, dropping rows with no match on either side.
- LEFT JOIN — A join that keeps every row of the left table and adds the matching right-hand rows, or NULLs when there is no match.
- CROSS JOIN — A join with no pairing rule, which pairs every row of one table with every row of the other.
- ON clause — The part of a join that states which rows of the two tables belong together.
- foreign key — A column holding another table's primary key value, which the database guarantees points at a row that exists.
- relational database — A database that stores data in tables and links rows in one table to rows in another through shared key values.
- shared database — One database used directly by several services.
Taught in
- Database Access & Migrations: ORM & Data Layers — Production Full-Stack Engineering
- Alert Triage, False Positive Reduction & Fatigue Mitigation — Security Operations & Threat Hunting (SOC)
- SIEM Architecture: Ingestion Pipelines & Indexing — Security Operations & Threat Hunting (SOC)
- Windows Event Logs, Sysmon & Linux Auditd Telemetry — Security Operations & Threat Hunting (SOC)
- Tracking Advanced Persistent Threats & Profiles — Security Operations & Threat Hunting (SOC)
- Incident Triage, Severity Scoping & Communication — Security Operations & Threat Hunting (SOC)
- Post-Incident Review & Root Cause Analysis — Security Operations & Threat Hunting (SOC)
- Disk Forensics: MFT, UsnJrnl & Prefetch — Security Operations & Threat Hunting (SOC)
- Malware Triage: Hashes, Strings & Sandboxing — Security Operations & Threat Hunting (SOC)
- Inner Joins And Table Aliases — PostgreSQL, Indexing & Relational Data Modeling
- What An Outer Join Really Returns — PostgreSQL, Indexing & Relational Data Modeling
- Cross Joins And Cartesian Bugs — PostgreSQL, Indexing & Relational Data Modeling
- The Storage Decision: Relational Versus Document — Scalable System Design & Distributed Architecture
- The Difference Between A Queue And A Log — Scalable System Design & Distributed Architecture
- Idempotency, And Exactly Once As A Fiction — Scalable System Design & Distributed Architecture
- Monolith Versus Services: The Honest Trade Offs — Scalable System Design & Distributed Architecture
- Capacity Planning As A Design Input — Scalable System Design & Distributed Architecture