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 (37)

Latest Posts

  • Data Quality: Dimensions and Error Classes — the Theory Behind the SQL Checks
    Published Jul 2, 2026 · Updated Sep 27, 2026
  • Skills vs. Rules in Claude Code — What Auto-Loads, What Loads on Demand, and the Context Cost
    Published Jul 6, 2026 · Updated Sep 28, 2026
  • The Agent Measures Where I Click — Debugging Postgres, Docker and a Swapping Server with a Coding Agent
    Published Sep 11, 2026 · Updated Sep 23, 2026
  • Set-Based vs. Row by Row: PostgreSQL Refresh from 114 to 12 Seconds
    Published Sep 23, 2026
  • Why sqlfluff Can’t Lint Our SQL Conventions — and a 240-Line Script Can
    Published Aug 23, 2026 · Updated Sep 21, 2026

Tags

AI-Assisted Development (12) AI Agents (6) Claude Code (21) Code Quality (6) Data Migration (7) Data Quality (18) Data Type (6) Developer Workflow (19) ETL Process (7) PL/pgSQL (6) PostgreSQL (18) Readability (7) SQL Server (6) T-SQL (11) 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) Database Deployment (5) Data Integration (1) Data Migration (7) 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 (1) 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 (18) 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 (6) SSIS (5) SSIS vs. SQL (4) Stored Procedure (1) T-SQL (11) Table Design (1) Theory (1) TRY_CONVERT (6) Type Conversion (8) Validation (1) Verification (1)