Junior
Ce este un Right Join?
sobes.tech AI
Răspuns de la AI
Right Join (sau RIGHT OUTER JOIN) este un tip de combinare a tabelelor în SQL care returnează toate rândurile din tabela dreaptă și rândurile corespunzătoare din tabela stângă. Dacă în tabela stângă nu există corespondențe pentru un rând din tabela dreaptă, câmpurile din tabela stângă vor fi completate cu valori NULL.
Caracteristici cheie:
- Păstrează toate înregistrările din tabela dreaptă.
- Returnează doar înregistrările corespunzătoare din tabela stângă.
- Pentru rândurile din tabela dreaptă fără corespondențe în stânga, câmpurile din tabela stângă vor fi
NULL.
Vizual, poate fi reprezentat astfel (R - tabela dreaptă, L - tabela stângă, i - corespondențe):
+---+-----+
| L | R+i |
+---+-----+
Sintaxă:
SELECT
column_list
FROM
left_table
RIGHT JOIN
right_table ON join_condition;