CASE-Anweisungen (EN)

Concept

Conditional logic in SQL queries for data manipulation

Architecture

flowchart TD     A[SELECT statement] --> B{CASE statement}     B --> C[WHEN condition 1]     B --> D[WHEN condition 2]     B --> E[ELSE alternative]     C --> F[Result 1]     D --> G[Result 2]     E --> H[Default result]     F --> I[Final result]     G --> I     H --> I 

In Context

  • Typically used together with aggregate functions such as SUM(), COUNT(), or AVG()
  • Related to: PIVOT operations, conditional aggregation, SQL window functions
  • Example use: Classification of data based on conditions in a SELECT query
Quelle: AI Generated