Round #572

09 May 2026, 23:16· csharp· Meta-Llama-3.3-70B-Instruct· r13-clean-hints
Complexity
band 1
ZP / UO / OBS
6 / 4 / 1
Journey weight
602
Lightshift ΔL

Prompt

Write a SQL query that returns customers with more than 3 orders.

Zero-point index (what the engine surfaced)

ZPI-ZPI-0006 | 2026-05-09T23:16:24Z Write a SQL query that returns customers with more than 3 orders. ZERO POINT — 6 entries (structural invariants) ● hsl(27.69, 100%, 50%) async [feature] ● hsl(145.64, 100%, 50%) Task of T [feature] ● hsl(348.72, 100%, 36%) IDisposable [feature] ● hsl(7.18, 100%, 50%) class [feature] ● hsl(0.00, 100%, 50%) public [feature] ● hsl(84.10, 100%, 50%) namespace [feature] UNOBSERVED — 4 entries (implied truths) ○ hsl(9.23, 100%, 50%) interface [feature] ○ hsl(180.92, 100%, 28%) Database health check [function] ○ hsl(144.00, 100%, 42%) Connection resilience [function] ○ hsl(83.08, 100%, 42%) ILogger of T injection [function] OBSERVED — 1 entries (explicit in request) ◉ hsl(98.46, 100%, 50%) with [feature] COMPLEXITY │ 11 entries │ spread: 172° │ band: MEDIUM

Baseline response (no ZPI)

**SQL Query: Customers with More Than 3 Orders** ```sql SELECT c.* FROM Customers c JOIN ( SELECT CustomerID, COUNT(OrderID) as OrderCount FROM Orders GROUP BY CustomerID HAVING COUNT(OrderID) > 3 ) o ON c.CustomerID = o.CustomerID; ``` **Explanation:** 1. We use a subquery to count the number of orders for each customer. 2. We group the orders by `CustomerID` and use the `HAVING` clause to filter customers with more than 3 orders. 3. We join the `Customers` table with the subquery result on the `CustomerID` column. 4. We select all columns (`*`) from the `Customers` table for the filtered customers. **Assumptions:** * `Customers` table has a column named `CustomerID`. * `Orders` table has columns named `OrderID` and `CustomerID`. * The database management system supports subqueries and joins. **Example Use Case:** Suppose we have the following tables: `Customers` table: | CustomerID | Name | Email | | --- | --- | --- | | 1 | John Doe | johndoe@example.com | | 2 | Jane Doe | janedoe@example.com | | 3 | Bob Smith | bobsmith@example.com | `Orders` table: | OrderID | CustomerID | OrderDate | | --- | --- | --- | | 1 | 1 | 2022-01-01 | | 2 | 1 | 2022-01-15 | | 3 | 1 | 2022-02-01 | | 4 | 1 | 2022-03-01 | | 5 | 2 | 2022-01-01 | | 6 | 2 | 2022-02-01 | | 7 | 3 | 2022-01-01 | | 8 | 3 | 2022-02-01 | | 9 | 3 | 2022-03-01 | | 10 | 3 | 2022-04-01 | | 11 | 3 | 2022-05-01 | Running the query will return: | CustomerID | Name | Email | | --- | --- | --- | | 1 | John Doe | johndoe@example.com | | 3 | Bob Smith | bobsmith@example.com | These are the customers with more than 3 orders.

Enhanced response (with ZPI)

```csharp using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.Extensions.Logging; public class Customer { public int Id { get; set; } public string Name { get; set; } public ICollection<Order> Orders { get; set; } } public class Order { public int Id { get; set; } public int CustomerId { get; set; } public Customer Customer { get; set; } } public class MyDbContext : DbContext { public DbSet<Customer> Customers { get; set; } public DbSet<Order> Orders { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseSqlServer(@"Data Source=(localdb)\mssqllocaldb;Initial Catalog=MyDatabase;Integrated Security=True"); } } public class CustomerService { private readonly MyDbContext _context; private readonly ILogger<CustomerService> _logger; public CustomerService(MyDbContext context, ILogger<CustomerService> logger) { _context = context; _logger = logger; } public async Task<List<Customer>> GetCustomersWithMoreThan3OrdersAsync() { try { var customers = await _context.Customers .Include(c => c.Orders) .Where(c => c.Orders.Count > 3) .ToListAsync(); return customers; } catch (Exception ex) { _logger.LogError(ex, "Error getting customers with more than 3 orders"); throw; } } } ``` This C# code defines a `Customer` and `Order` class, and a `MyDbContext` class that inherits from `DbContext`. The `CustomerService` class uses the `MyDbContext` to query the database for customers with more than 3 orders. The `GetCustomersWithMoreThan3OrdersAsync` method uses Entity Framework Core to include the `Orders` navigation property in the query, and then filters the results to only include customers with more than 3 orders. If an error occurs during the query, it is logged using the `ILogger` instance. The SQL query that is generated by this code is equivalent to the following: ```sql SELECT [c].[Id], [c].[Name] FROM [Customers] AS [c] INNER JOIN ( SELECT [c0].[Id], COUNT(*) AS [count] FROM [Customers] AS [c0] INNER JOIN [Orders] AS [o] ON [c0].[Id] = [o].[CustomerId] GROUP BY [c0].[Id] HAVING COUNT(*) > 3 ) AS [t] ON [c].[Id] = [t].[Id] ``` This query joins the `Customers` table with a subquery that counts the number of orders for each customer, and then filters the results to only include customers with more than 3 orders.

Grader chain

Each grader reads the same baseline + enhanced pair and casts an independent verdict. Disagreement is the framework's own signal — not noise to be averaged away.

V1samba/Meta-Llama-3.3-70B-Instruct
Better
V4qwen2.5-coder-3b-instruct
Better
V5openrouter/qwen/qwen3-235b-a22b-2507
Better
V7qwen2.5-coder-7b-instruct
Better
V8openai/gpt-4.1
Better
V9anthropic/claude-opus-4-7
Worse
V12openai/gpt-4o
Better

Comments

Our grader said what it said. What do you say? Comment as a guest below.

No comments yet. Be the first to say what you make of this round.

← back to all rounds