Przejdź do treści
Biblioteka skilli
Dane i analityka · Nauka i wyjaśnianie

sql-joins

/sql-joins

Pomaga dobrać i napisać join, który zachowuje właściwą liczbę wierszy, i wyjaśnia, dlaczego wynik urósł.

Repozytorium
AI-SKILLS ↗
Licencja
MIT
Ostatnia zmiana repozytorium
05.09.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 05.09.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Pomaga dobrać i napisać join, który zachowuje właściwą liczbę wierszy, i wyjaśnia, dlaczego wynik urósł.

Oryginalny opis (EN)

Choose and write the right join so rows are neither lost nor multiplied, and know why a result set grew. Use when combining tables and the row count or the null columns look wrong.

Jak działa

  1. Method
  2. Boundaries
Sekcje z nagłówków SKILL.md, w oryginale · 43 linii, 346 słów
Podgląd SKILL.md
---
name: sql-joins
description: Choose and write the right join so rows are neither lost nor multiplied, and know why a result set grew. Use when combining tables and the row count or the null columns look wrong.
---

# SQL joins

Almost every wrong query result traces to a join: an inner join that
silently dropped the rows you cared about, or a join on a non-unique key
that quietly multiplied them. Joins are simple to write and easy to get
subtly wrong, which is why the row count is the first thing to check.

## Method

1. **State the grain before writing the join.** One row per what?
   Per order, per order line, per customer. Knowing the intended grain is
   what lets you see immediately that a result is wrong.
2. **Pick the join by what should survive.** Inner keeps only matches,
   left keeps every row of the left side, and full keeps both. Choosing
   inner when you meant left is the most common cause of quietly missing
   rows.
3. **Check the key's uniqueness on both sides.** Joining on a column
   that repeats on the right multiplies rows. If the right side is not
   unique per key, aggregate it first or accept the fan-out knowingly.
4. **Put filters in the right place.** A condition on the right table in
   the WHERE clause turns a left join into an inner join, because null
   fails the comparison. Filters that must not do that belong in the ON
   clause.
5. **Count before and after.** Compare the row count to the left table's
   count when you expected preservation. A join that changed the count
   unexpectedly is a bug you found early rather than a wrong number you
   shipped.
6. **Use an anti-join to find what is missing.** A left join filtered to
   null on the right, or NOT EXISTS, answers which rows have no match,
   which is usually clearer than NOT IN and safe with nulls (see
   null-semantics).

## Boundaries

- Joins combine rows; they do not fix a schema where the relationship is
  ambiguous (see database-normalization).
- Join performance depends on indexes and plan choice, which is a
  separate concern from correctness (see indexing-strategy,
  query-plan-reading).
- Cross joins are occasionally intended, so an exploding row count is
  only a bug relative to the grain you declared.

Wersje

W bazie nie ma innych skilli o nazwie sql-joins.

Migawka bazy z 13.11.2026 · wersja paczki 9a0a764219e0 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100spatial-joins-and-keys
    Łączy tabele z warstwami przestrzennymi i po atrybucie, pilnując kluczy, zer wiodących i uczciwie raportując liczbę dopasowań.
  • 90null-semantics
    Wyjaśnia semantykę NULL w SQL w porównaniach, agregatach, złączeniach i unikalności, aby brakujące wartości przestały po cichu gubić wiersze.
  • 90investigate
    Bada problem jakości danych, np. spadek metryki, duplikaty lub złą liczbę wierszy po joinie, i szuka przyczyny źródłowej.
  • 100reproducible-analysis
    Profiluje zbiór danych i sprawdza wynik przed raportowaniem, zwłaszcza gdy złączenie lub filtr zmienia liczbę wierszy.
  • 90sql-set-operations
    Łączy wyniki zapytań przez UNION, INTERSECT i EXCEPT i wskazuje, kiedy lepszy jest join lub klauzula exists.
  • 100sql
    Pisze, poprawia i uruchamia zapytania SQL oraz analizuje pliki CSV i SQLite przy pomocy narzędzia sqlite3.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.