SQL
AuraScore 83/100

Catalog Windowing and Royalty Allocation SQL Assessment

Review and refine SQL queries that compute complex content consumption metrics, windowing rights, and royalty allocations.

Use this template when auditing studio content licensing performance or resolving complex SVOD/AVOD rights accounting calculations in SQL. It establishes rigorous validation methods for content rights windowing queries.

Template

Role: Senior Content Performance Analyst & Royalties Database Specialist with 10+ years modeling media rights, windowing logic, and digital distributor royalties.

Context

  • Content Studio / Distributor: {{studio_name}}
  • Database Engine: {{target_sql_dialect}}
  • Catalog Metadata Schema: {{catalog_metadata_schema}}
  • Windowing & Rights Rules: {{windowing_contract_rules}}
  • Consumption Metric: {{consumption_metric_type}}
  • Licensing Partner List: {{licensing_partner_list}}

Task

Produce a rigorous analysis of the SQL models responsible for evaluating catalog performance, windowing compliance, and royalty revenue share distribution for {{studio_name}}, identifying calculation errors and query bottlenecks.

Method

  1. Review the entity-relationship joins between {{catalog_metadata_schema}} and consumption logs for title-level ID collision.
  2. Verify contract effective date overlaps against {{windowing_contract_rules}} to detect accidental multi-exclusive territory allocations.
  3. Audit SQL window functions calculating {{consumption_metric_type}} across regional tier splits for license partners in {{licensing_partner_list}}.
  4. Check NULL handling in revenue share calculation formulas during mid-month licensing tier transitions.
  5. Inspect aggregation performance on high-volume asset stream history tables under {{target_sql_dialect}}.
  6. Validate tier-capped royalty thresholds using recursive CTEs or analytical ranking functions.
  7. Formulate audit test queries that highlight content viewed outside authorized release windows.

Constraints

  • MUST ensure SQL logic strictly enforces rights window start and end boundaries without date truncation leakage.
  • MUST NOT aggregate metrics at the studio level before applying partner-specific licensing minimums.
  • All query refactorings must be fully compliant with {{target_sql_dialect}} syntax.
  • Any edge cases where metadata is missing must be handled defensively without silent row drops.

Output format

Format the deliverable into four sequential sections:

  1. Rights Logic & SQL Architecture Findings (200-300 words)
  2. Royalty Calculation Vulnerabilities (table: Contract Rule, Query Logic Flaw, Royalty Distortion Risk)
  3. Refactored Royalty Allocation SQL Model (a complete, production-ready CTE-based script)
  4. Catalog Analytics Validation Checklist (5-7 actionable technical testing steps)

Self-review

  • Confirm all boundary date joins in {{windowing_contract_rules}} avoid double-counting active windows.
  • Verify syntax and analytical functions run natively in {{target_sql_dialect}}.
  • Ensure all licensing partners in {{licensing_partner_list}} are represented in the validation model.
AuraScore breakdown
83/100Provisional
Instruction clarity15/15 · Strong

Explicit role, a named task, and discrete steps the model can follow.

Context architecture12/12 · Strong

Background, inputs and variables the model needs before it starts.

Constraint engineering12/12 · Strong

Hard boundaries — what the model must and must not do.

Output specification6/14 · Thin

A named, field-level shape for the response.

Reasoning structure10/10 · Strong

Ordered work items that force analysis before an answer.

Model compatibility10/10 · Strong

Length and structure that travel across frontier models.

Token efficiency5/10 · Thin

Signal density — instruction weight without padding.

Reusability7/7 · Strong

Documented variables so the scaffold adapts to new inputs.

Robustness5/5 · Strong

Quality bar, assumptions and behaviour when inputs are thin.

Observed performance1/5 · Thin

How much real usage the template has behind it.

data-analytics
data-sql
media-entertainment
sql
content-analytics
media-royalties