sql-set-operations
/sql-set-operations
Łączy wyniki zapytań przez UNION, INTERSECT i EXCEPT i wskazuje, kiedy lepszy jest join lub klauzula exists.
- Autor
- Amey-Thakur ↗
- Repozytorium
- AI-SKILLS ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 05.09.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 05.09.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Łączy wyniki zapytań przez UNION, INTERSECT i EXCEPT i wskazuje, kiedy lepszy jest join lub klauzula exists.
Oryginalny opis (EN)
Combine result sets with UNION, INTERSECT, and EXCEPT, and know when a join or an exists clause is the better tool. Use when merging or comparing two query results rather than two tables.
Jak działa
- Method
- Boundaries
Podgląd SKILL.md
--- name: sql-set-operations description: Combine result sets with UNION, INTERSECT, and EXCEPT, and know when a join or an exists clause is the better tool. Use when merging or comparing two query results rather than two tables. --- # SQL set operations Set operations stack result sets vertically, where joins widen them horizontally. They are the right tool for combining like-shaped results and for asking what is in one set and not the other, and the wrong tool for enriching rows. ## Method 1. **Prefer UNION ALL unless you need deduplication.** UNION sorts or hashes to remove duplicates, which costs real time on large sets. If duplicates are impossible, say so with ALL. 2. **Match the column list exactly.** Same count, same order, compatible types. Positional matching means a reordered select in one branch produces plausible, wrong output rather than an error. 3. **Use EXCEPT to find what is missing.** It answers which rows in the first set have no counterpart, and it reads more clearly than an anti-join when both sides are already query results. 4. **Remember set operations compare whole rows.** INTERSECT and EXCEPT consider every selected column, so including an extra column changes the answer entirely. 5. **Order once at the end.** An ORDER BY applies to the combined result, and ordering inside branches is meaningless without a limit. 6. **Reach for EXISTS when you only need a test.** Checking whether a related row exists is cheaper and clearer than building and comparing sets (see sql-joins). ## Boundaries - Set operations need like-shaped results; combining differently shaped data means a join or a rework of the query. - INTERSECT and EXCEPT treat nulls as matching for these purposes, which differs from ordinary comparison (see null-semantics). - Support varies: some engines lack INTERSECT and EXCEPT and need an anti-join instead.
Wersje
W bazie nie ma innych skilli o nazwie sql-set-operations.
Migawka bazy z 13.11.2026 · wersja paczki 9fbaa19ca268 (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
- 100sql-joins
Pomaga dobrać i napisać join, który zachowuje właściwą liczbę wierszy, i wyjaśnia, dlaczego wynik urósł. - 100sql-query-generation
Generuje zapytania SQL z wymagań w języku naturalnym: SELECT, JOIN, GROUP BY, funkcje okna, CTE i podzapytania, na podstawie pytania biznesowego lub schematu. - 100sql-query-optimizer
Prawdopodobnie optymalizuje zapytania SQL w ramach kategorii Data Analytics. - 100sql-to-insights
Zamienia wyniki zapytań SQL w narrację decyzyjną: główne ustalenie, czynniki i rekomendacja, z doborem wykresu do kształtu danych. - 92sql
Odpytuje graf Minerval i jego rejestr działań tylko do odczytu w SQL: opisuje widoki, połączenia i liczniki dla typowych pytań. - 100sql
Pisze, poprawia i uruchamia zapytania SQL oraz analizuje pliki CSV i SQLite przy pomocy narzędzia sqlite3.