Skip to content
SQL & Beyond

SQL & Beyond

  • home
  • featured
    • marcus-belz.de
    • Pencil’n more
    • DI²
    • GitHub: di2-starter-kit
    • my son’s web site
    • Alex Sprogis: AI Coding Starter Kit
  • imprint
  • privacy
  • contact
  • English
    • Deutsch
    • English

Duplicates

Finding Duplicates with SQL — From COUNT(*) > 1 to Composite Keys

22. August 20261. July 2026 by marcus

GROUP BY … HAVING count(*) > 1 may be the most-typed SQL snippet in the world — and yet it trips up in two places almost nobody has on their radar: composite keys and NULL. When it comes to missing values in a unique column, SQL Server and Postgres disagree — one allows exactly one NULL, the other any … Read more

Tags Data Quality, Data Quality Rules, Duplicates, Dynamic SQL

Newsletter

Sign up

Article Series

  • Data Quality in an ETL Process
  • Data Quality Checks with SQL
  • Data Migration: SQL Server → PostgreSQL
  • AI-Assisted SQL Development
  • Structuring & Formatting SQL
  • SSIS vs. T-SQL

Categories

  • AI & Development (23)
  • Data Quality (8)
  • Database Deployment (5)
  • SQL & Databases (39)

Latest Posts

  • Data Quality: Dimensions and Error Classes — the Theory Behind the SQL Checks
    Published Jul 2, 2026 · Updated Sep 27, 2026
  • ETL vs. ELT — How to Tell Which Pattern You Actually Built
    Published Jun 24, 2026 · Updated Oct 12, 2026
  • Reading Complex XML in SQL Server — Shredding a Thousand Attributes Generically Instead of Looping for Hours
    Published Oct 11, 2026 · Updated Oct 12, 2026
  • Set-Based vs. Row by Row: PostgreSQL Refresh from 114 to 12 Seconds
    Published Sep 23, 2026 · Updated Oct 11, 2026
  • Schema Migration SQL Server → PostgreSQL — Identity, Constraints, Defaults, Sequences
    Published Jun 26, 2026 · Updated Oct 7, 2026
  • Verifying the Migration — Data Quality and Row Reconciliation After the Move
    Published Jun 28, 2026 · Updated Oct 7, 2026

Tags

AI-Assisted Development (12) AI Agents (6) Claude Code (21) Code Quality (6) Data Migration (8) Data Quality (18) Data Type (6) Developer Workflow (19) ETL Process (7) PL/pgSQL (6) PostgreSQL (19) Readability (7) SQL Server (8) T-SQL (12) TRY_CONVERT (6) Type Conversion (8)

Show all tags

© 2018–2026 Marcus Belz · Imprint · Privacy · Contact · How This Blog Is Made

All tags

AI (1) AI-Assisted Development (12) AI Agents (6) Automation (1) Backfill (1) Change Tracking (1) CI/CD (2) Claude (1) Claude Code (21) Code Quality (6) Comparison (1) Context Management (1) Conventions (3) Cutover (1) Database Deployment (5) Data Integration (1) Data Migration (8) Data Quality (18) Data Quality Dimensions (1) Data Quality Rules (4) Data Transfer (1) Data Type (6) Data Type Mapping (1) Design Pattern (5) Developer Workflow (19) Duplicates (1) Dynamic SQL (4) ELT (2) Error Classification (1) ESLint (1) ETL (1) ETL Process (7) Expand/Contract (1) Formatting (5) GitHub Actions (2) Logging (1) Maintainability (3) Metadata (1) Naming Convention (4) PL/pgSQL (6) Postgres (5) PostgreSQL (19) Project Setup (1) Project Template (1) Prompt Engineering (1) Readability (7) Referential Integrity (1) Schema Evolution (3) Schema Migration (3) Source Control (1) SQL Server (8) SSIS (5) SSIS vs. SQL (4) Stored Procedure (1) T-SQL (12) Table Design (1) Theory (1) TRY_CONVERT (6) Type Conversion (8) Validation (1) Verification (1) XML (1)