SQL INNER JOIN

Keeps only rows that have a match on BOTH sides — the strictest, most common join type, and usually what people mean by just 'JOIN.'

What & Why

INNER JOIN combines rows only when the join condition matches on both sides. In the Queryflo example, a product.feedback row is returned only when its feature_id matches a row in product.features; plain JOIN means the same thing as INNER JOIN in PostgreSQL.

See How It Works

BUSINESS QUESTION

Product wants feedback rows with known feature metadata.

iduser_idfeature_idratingnps_scorecommentcreated_at
1101159Clear and useful2024-01-25 12:15:00+00
210224NULLExport worked well2024-02-20 15:40:00+00
3103147Helpful setup flow2024-03-18 09:05:00+00
410433NULLNeeds clearer timing2024-04-08 17:30:00+00
idnamedescriptionteamreleased_atdeprecated_at
1Activation ChecklistGuides new users through setupgrowth2024-01-20NULL
2CSV ExportExports report dataplatform2024-02-14NULL
3Invite NudgesPrompts workspace collaborationgrowth2024-03-05NULL
4Legacy DashboardOriginal reporting surfaceanalytics2023-08-102024-06-01
Trace the relationship row by row1× speed
product.features
idname
1Activation Checklist
2CSV Export
3Invite Nudges
4Legacy Dashboard
feature.id = feedback.feature_id
product.feedback
idfeature_idratingcreated_at
1152024-01-25 12:15:00+00
2242024-02-20 15:40:00+00
3142024-03-18 09:05:00+00
4332024-04-08 17:30:00+00
Result set · 1 rows
nameratingcreated_at
Activation Checklist52024-01-25 12:15:00+00

Feedback 1 matches feature 1.

EXAMPLE QUERY
SELECT
  f.name,
  fe.rating,
  fe.created_at
FROM product.feedback fe
INNER JOIN product.features f ON f.id = fe.feature_id
ORDER BY fe.id;
Now You Try

Practice this concept

Product wants feedback rows with their matching feature metadata.

Available schema
product

Prefix tables with product.table_name.

nameratingcreated_at
product.features
ColumnType
idinteger
nametext
descriptiontext
teamtext
released_attimestamp with time zone
deprecated_attimestamp with time zone
internal_priorityinteger
product.feedback
ColumnType
idinteger
user_idinteger
feature_idinteger
ratinginteger
nps_scoreinteger
commenttext
created_attimestamp with time zone
moderation_buckettext
query.sql
Intermediate business practice

Sign up free to try it on a real business scenario