PGoCareerGoCareer prep tools
LoginSign up
  • Java
  • Python
  • AI
  • React
  • Angular
  • PHP
  • Node.js
  • SQL
  • DSA
  • HTML
  • CSS
  • JS
  • Spring
  • ML
  • MongoDB

SQL · Theory

Right Join

← All stacks

Theory

62/439

Right Join

RIGHT JOIN keeps all rows from the right table. It is LEFT JOIN with the tables swapped. Most teams write LEFT JOIN only, and put the ‘must keep’ table on the left.

Know the name for MCQs. In code, prefer LEFT JOIN for readability.

Trap — mixing LEFT and RIGHT in one query until nobody can draw it.

On the example next to this theory — Right Join — jOIN combines rows using a match condition between tables.

Diagram
  students.id
       =
  marks.student_id
        │
        ▼
     one result row
Exam tip

RIGHT JOIN = LEFT JOIN with tables swapped. Prefer LEFT.

Right Join — sample query

CREATE TABLE customers (id INTEGER PRIMARY KEY, name TEXT);
CREATE TABLE orders (id INTEGER PRIMARY KEY, customer_id INTEGER, total INTEGER);
INSERT INTO customers VALUES (1, 'Asha'), (2, 'Ravi');
INSERT INTO orders VALUES (10, 1, 500), (11, 1, 200);
SELECT c.name, o.total
FROM customers c
JOIN orders o ON o.customer_id = c.id;

Right Join — jOIN combines rows using a match condition between tables.

Short notes

  • DefRIGHT JOIN keeps all right-table rows.
  • RuleSame as swapping tables and using LEFT JOIN.
  • TrapUsing RIGHT when LEFT would read better.

Questions

1

RIGHT vs LEFT?

62 / 439

P

GoCareerGo

Utilities · Preparation Hub · Resume · CV · Tools — one workspace.

Workspace

DashboardProfilePreparation HubResume builderCV builderCareer planning

PDF Tools

Merge PDFSplit PDFCompress PDFImage to PDFAll toolsJobs

Image & QR

Compress ImageResize ImageQR ScannerQR GeneratorBlogIT interview prep

Company

FAQFeedbackContactPrivacyTermsSitemap

© 2026 GoCareerGo. Keep moving forward.