D3 sql+executed, run 3: the query session

← back to the run

5 queries0 failed1 rounds
The opening prompt
## The data

You can't see the data, but you can query it. It is in DuckDB, in the tables below. Write DuckDB SQL.

To run queries, reply with one or more fenced blocks (```sql), and nothing else is needed:
each is run and its results sent back to you. You have up to 8 rounds of queries.
When you have what you need, reply with the final answers and no queries.

All columns are text (VARCHAR); dates are ISO strings.

- `entities` (16 rows): entity_id, name, lei, country, entity_type, parent_id, ultimate_parent_id, record_ids
- `instruments` (8 rows): instrument_id, description, issuer_id, guarantor_id, credit_risk_of, seniority, currency, local_currency, maturity
- `ratings` (41 rows): rated_id, rating_type, ccy_basis, rating, outlook, watch, action, valid_from, valid_to, action_id
- `ceilings` (2 rows): country, ceiling, valid_from
- `ancestors` (4 rows): entity_id, ancestor_id, levels_up

These tables are the data after its rules have been applied: duplicate records merged into one entity (record_ids lists the records each entity merges), and each rating with the period it held. An empty valid_to means the rating was still in force on 1 October 2026. ancestors lists every entity above each entity in its chain of parents, with how many levels up.

## Questions

Answer each question below from the data above. Start each answer on a new line with its
number in bold, like **Q1.**, give the direct answer first, then at most two sentences of
reasoning that cite the records (IDs) you relied on.

Then end with one JSON block (```json) holding the structured answer to each question listed
here, with exactly these fields, shaped like {"Q1": {"field": value}, ...}. Name entities by their record ID: the entity_id in the CSV files, or the part of the IRI after lad: in the RDF (E01, not Kestrel Energy plc).

- Q1: rating (a rating, or "none")
- Q2: downgraded ("yes", "no" or "depends")
- Q3: investment_grade ("yes", "no" or "depends"), rating (a rating, or "none")
- Q4: outlook (an outlook)
- Q5: risk_of (a record ID), rating (a rating, or "none")
- Q7: issuers (a list of record IDs)
- Q8: entities (a list of record IDs)
- Q9: count (a number)
- Q10: investment_grade ("yes", "no" or "depends")
- Q11: rating (a rating, or "none")
- Q12: rating (a rating, or "none")
- Q13: count (a number)
- Q14: rating (a rating, or "none")
- Q15: rating (a rating, or "none")
- Q16: changed ("yes", "no" or "depends")
- Q17: downgraded ("yes", "no" or "depends")
- Q18: issuers (a list of record IDs)
- Q19: issuers (a list of record IDs)
- Q20: in_default ("yes", "no" or "depends")
- Q21: entities (a list of record IDs)
- Q22: entities (a list of record IDs)
- Q23: rating (a rating, or "none")
- Q24: investment_grade ("yes", "no" or "depends")
- Q25: count (a number)
- Q26: rating (a rating, or "none")
- Q27: rating (a rating, or "none")
- Q28: rating (a rating, or "none")
- Q29: rating (a rating, or "none")
- Q30: entities (a list of record IDs)
- Q31: any ("yes", "no" or "depends")
- Q32: parent (a record ID)
- Q33: risk_of (a record ID), rating (a rating, or "none")
- Q34: same_group ("yes", "no" or "depends")
- Q35: count (a number)
- Q36: count (a number)
- Q37: count (a number)
- Q38: same ("yes", "no" or "depends")
- Q39: rating (a rating, or "none")
- Q40: count (a number)
- Q41: rating (a rating, or "none")
- Q42: country (a country code)
- Q43: count (a number)
- Q44: local_currency ("yes", "no" or "depends")
- Q45: above_ceiling ("yes", "no" or "depends")
- Q46: issuer_rating ("yes", "no" or "depends")
- Q47: rating (a rating, or "none")
- Q48: count (a number)

Q1. What was Kestrel Energy's rating on 1 January 2025?
Q2. Has Kestrel Energy been downgraded in 2026?
Q3. Is Kestrel Energy's 2031 note investment grade?
Q4. What is Northwind Holdings' current outlook?
Q5. Whose credit risk does a holder of the Northwind Finance 2030 notes take, and how is it rated?
Q6. Why is Valdoria Telecom's foreign-currency rating lower than its local-currency rating?
Q7. Which issuers were downgraded in 2026?
Q8. Which entities were in default on 1 October 2026?
Q9. As of 1 October 2026, how many distinct issuers hold an issuer rating?
Q10. Is Valdoria Telecom investment grade?
Q11. What was Marlow Utilities' rating on 1 June 2025?
Q12. What was Marlow Utilities' rating on 1 January 2024?
Q13. How many times has Marlow Utilities been downgraded?
Q14. What was Halden Foods' rating on 1 January 2024?
Q15. What was Halden Bank's rating on 1 January 2026?
Q16. Has Marlow Utilities' rating changed since 1 January 2025?
Q17. Was Orrin Bank downgraded in 2026?
Q18. Which issuers were on Rating Watch Negative on 1 October 2026?
Q19. Which issuers had a Negative outlook on 1 October 2026?
Q20. Is Pellam Retail in default?
Q21. Which entities had an issuer rating at some point but no longer had one on 1 October 2026?
Q22. Which entities have ever been in default?
Q23. What is Kestrel Energy's short-term rating?
Q24. Is Kestrel Energy's issuer rating investment grade?
Q25. How many instruments held an investment-grade rating on 1 October 2026?
Q26. What is Corvenia Power's local-currency rating?
Q27. How is Corvenia Power's 2032 note rated?
Q28. What is the Republic of Corvenia's foreign-currency issuer rating?
Q29. What is the Republic of Valdoria's issuer rating?
Q30. Which entities had a foreign-currency issuer rating exactly at their country's ceiling on 1 October 2026?
Q31. Did any company have a foreign-currency issuer rating above its country's ceiling on 1 October 2026?
Q32. Who is Halden Leasing's ultimate parent?
Q33. Whose credit risk does a holder of the Halden Leasing 2028 notes take, and how is it rated?
Q34. Is Halden Foods part of the same group as Halden Bank?
Q35. How many entities are in the Halden group, the parent included?
Q36. How many entities are in the Northwind group, the parent included?
Q37. How many distinct legal entities does the data describe?
Q38. Are Orrin Bank AG and Orrin Bancorp Inc the same entity?
Q39. What is Northwind Holdings' current rating?
Q40. How many distinct issuers domiciled in GB held an issuer rating on 1 October 2026?
Q41. What is Brindle Capital's current rating?
Q42. In which country is Halden Bank domiciled?
Q43. How many distinct entities are domiciled in Luxembourg (LU)?
Q44. Is Valdoria Telecom's 2027 note a local-currency obligation?
Q45. Is Valdoria Telecom's 2027 note rated above what Valdoria's Country Ceiling allows?
Q46. Does Halden Leasing have an issuer rating?
Q47. How is Corvenia Power's 2034 note rated?
Q48. How many instruments held a rating on 1 October 2026?
The model
I'll start by looking at the data.

```sql
SELECT * FROM entities;
```
```sql
SELECT * FROM instruments;
```
```sql
SELECT * FROM ratings ORDER BY rated_id, rating_type, ccy_basis, valid_from;
```
```sql
SELECT * FROM ceilings;
```
```sql
SELECT * FROM ancestors;
```
Query results
Query 1:

| entity_id | name | lei | country | entity_type | parent_id | ultimate_parent_id | record_ids |
|---|---|---|---|---|---|---|---|
| CV | Republic of Corvenia |  | CV | SOV |  |  | CV |
| VD | Republic of Valdoria |  | VD | SOV |  |  | VD |
| E01 | Kestrel Energy plc | 7245002OOPBG04092E43 | GB | CORP |  |  | E01 |
| E02 | Northwind Holdings plc | 213800PHEIYNJMHTDV74 | GB | CORP |  |  | E02 E03 |
| E04 | Northwind Finance BV | 213800LA5RYJLGXV2T85 | NL | FINSUB | E02 | E02 | E04 |
| E05 | Valdoria Telecom SA | 391200LESH03LMOY2U61 | VD | CORP |  |  | E05 |
| E06 | Orrin Bank AG | 549300AMVE3VRVG7HK43 | DE | BANK |  |  | E06 |
| E07 | Pellam Retail Ltd | 969500B6IUACELPI2291 | GB | CORP |  |  | E07 |
| E08 | Saxby Shipping SA | 969500KOTZ1JFIZSG796 | GR | CORP |  |  | E08 |
| E09 | Halden Group plc | 815600ASM9EHDG931T89 | GB | CORP |  |  | E09 |
| E10 | Halden Bank AG | 391200QYPVFF2O9K2039 | LU | BANK | E09 | E09 | E10 E17 |
| E11 | Halden Leasing SA | 549300XBZH4ULO9MQV55 | FR | FINSUB | E10 | E09 | E11 |
| E12 | Halden Foods Ltd | 213800IJDL4OJ4DG5T19 | GB | CORP |  |  | E12 |
| E13 | Orrin Bancorp Inc | 815600O8X8K2F154N214 | US | BANK |  |  | E13 |
| E14 | Marlow Utilities plc | 3912005AH2C1I9YF8106 | GB | CORP |  |  | E14 |
| E15 | Corvenia Power SA | 213800PBQVHVBBH6GV02 | CV | CORP |  |  | E15 |

Query 2:

| instrument_id | description | issuer_id | guarantor_id | credit_risk_of | seniority | currency | local_currency | maturity |
|---|---|---|---|---|---|---|---|---|
| I01 | Kestrel Energy 4.50% notes due 2030 | E01 |  | E01 | SU | GBP | no | 2030-03-15 |
| I02 | Kestrel Energy 6.25% notes due 2031 | E01 |  | E01 | SUB | GBP | no | 2031-09-30 |
| I03 | Northwind Finance 3.75% notes due 2030 | E04 | E02 | E02 | SU | EUR | no | 2030-05-01 |
| I04 | Valdoria Telecom 5.00% notes due 2029 | E05 |  | E05 | SU | USD | no | 2029-11-20 |
| I05 | Halden Leasing 2.90% notes due 2028 | E11 | E10 | E10 | SU | EUR | no | 2028-06-30 |
| I06 | Corvenia Power 7.10% notes due 2032 | E15 |  | E15 | SUB | USD | no | 2032-02-15 |
| I07 | Valdoria Telecom 4.25% notes due 2027 | E05 |  | E05 | SU | XVD | yes | 2027-08-31 |
| I08 | Corvenia Power 6.00% notes due 2034 | E15 |  | E15 | SU | USD | no | 2034-09-01 |

Query 3:

| rated_id | rating_type | ccy_basis | rating | outlook | watch | action | valid_from | valid_to | action_id |
|---|---|---|---|---|---|---|---|---|---|
| CV | LTIDR | FC | BBB+ | STA |  | AS | 2024-01-01 |  | A38 |
| CV | LTIDR | LC | A- | STA |  | AS | 2024-01-01 |  | A39 |
| E01 | LTIDR | FC | A- | STA |  | AS | 2024-03-12 | 2025-06-20 | A01 |
| E01 | LTIDR | FC | BBB | STA |  | DG | 2025-06-20 | 2026-02-10 | A02 |
| E01 | LTIDR | FC | BBB | NEG |  | AF | 2026-02-10 |  | A03 |
| E01 | STIDR | FC | F2 |  |  | AF | 2026-02-10 |  | A04 |
| E02 | LTIDR | FC | A | STA |  | AS | 2023-11-01 | 2025-09-15 | A08 |
| E02 | LTIDR | FC | A | POS |  | AF | 2025-09-15 |  | A09 |
| E05 | LTIDR | FC | BB | STA |  | AS | 2025-04-01 |  | A14 |
| E05 | LTIDR | LC | BBB- | STA |  | AS | 2025-04-01 |  | A13 |
| E06 | LTIDR | FC | A- | STA |  | AS | 2024-05-01 | 2026-09-03 | A16 |
| E06 | LTIDR | FC | A- |  | RWN | RW | 2026-09-03 |  | A17 |
| E07 | LTIDR | FC | BB | STA |  | AS | 2024-01-10 | 2026-05-12 | A18 |
| E07 | LTIDR | FC | WD |  |  | WD | 2026-05-12 |  | A19 |
| E08 | LTIDR | FC | B | STA |  | AS | 2024-06-01 | 2026-01-20 | A20 |
| E08 | LTIDR | FC | CCC |  |  | DG | 2026-01-20 | 2026-07-08 | A21 |
| E08 | LTIDR | FC | RD |  |  | DG | 2026-07-08 |  | A22 |
| E09 | LTIDR | FC | A | STA |  | AS | 2023-05-01 | 2026-03-01 | A24 |
| E09 | LTIDR | FC | A | NEG |  | AF | 2026-03-01 |  | A25 |
| E10 | LTIDR | FC | A- | STA |  | AS | 2023-05-01 | 2026-04-15 | A26 |
| E10 | LTIDR | FC | BBB+ | STA |  | DG | 2026-04-15 |  | A27 |
| E12 | LTIDR | FC | BB- | STA |  | AS | 2024-02-01 | 2025-08-01 | A30 |
| E12 | LTIDR | FC | BB | STA |  | UG | 2025-08-01 |  | A31 |
| E13 | LTIDR | FC | BBB | STA |  | AS | 2024-07-01 |  | A32 |
| E14 | LTIDR | FC | A- | STA |  | AS | 2023-01-15 | 2024-09-30 | A34 |
| E14 | LTIDR | FC | BBB+ | STA |  | DG | 2024-09-30 | 2025-11-20 | A36 |
| E14 | LTIDR | FC | BBB+ |  | RWN | RW | 2025-11-20 | 2026-05-01 | A35 |
| E14 | LTIDR | FC | BBB+ | STA |  | AF | 2026-05-01 |  | A33 |
| E15 | LTIDR | FC | A | STA |  | AS | 2024-03-01 |  | A41 |
| E15 | LTIDR | LC | A+ | STA |  | AS | 2024-03-01 |  | A40 |
| I01 | INST |  | A- |  |  | AS | 2024-03-12 | 2025-06-20 | A05 |
| I01 | INST |  | BBB |  |  | DG | 2025-06-20 |  | A06 |
| I02 | INST |  | BBB |  |  | AS | 2024-03-12 | 2025-06-20 | A23 |
| I02 | INST |  | BB+ |  |  | DG | 2025-06-20 |  | A07 |
| I03 | INST |  | A |  |  | AS | 2023-11-01 | 2025-09-15 | A10 |
| I03 | INST |  | A |  |  | AF | 2025-09-15 |  | A11 |
| I04 | INST |  | BB |  |  | AS | 2025-04-01 |  | A15 |
| I05 | INST |  | A- |  |  | AS | 2023-06-01 | 2026-04-15 | A28 |
| I05 | INST |  | BBB+ |  |  | DG | 2026-04-15 |  | A29 |
| I06 | INST |  | A- |  |  | AS | 2024-03-01 |  | A42 |
| I07 | INST |  | BBB- |  |  | AS | 2025-04-01 |  | A45 |

Query 4:

| country | ceiling | valid_from |
|---|---|---|
| CV | A | 2024-01-01 |
| VD | BB | 2025-04-01 |

Query 5:

| entity_id | ancestor_id | levels_up |
|---|---|---|
| E04 | E02 | 1 |
| E10 | E09 | 1 |
| E11 | E10 | 1 |
| E11 | E09 | 2 |

Run more queries, or give the final answers.
The model
**Q1.** A-. Kestrel's foreign-currency long-term rating was A- on that date (A01, valid 2024-03-12 to 2025-06-20).

**Q2.** No. The only downgrade was on 2025-06-20 (A02). The 2026-02-10 action (A03) was an affirmation at BBB, with the outlook moving to Negative.

**Q3.** No. The 2031 note (I02) has been rated BB+ since 2025-06-20 (A07), which is sub-investment grade.

**Q4.** Positive. E02's current rating (A09) has a POS outlook. E03 is merged into E02.

**Q5.** E02, the guarantor of I03 and the instrument's credit_risk_of. It is rated A (I03, A11), and E02's issuer rating is also A.

**Q6.** The data doesn't state a reason, but it is consistent with the Country Ceiling. Valdoria's ceiling is BB (from 2025-04-01), and E05's foreign-currency rating is BB (A14) against BBB- in local currency (A13).

**Q7.** E08 and E10. E08 was downgraded on 2026-01-20 and 2026-07-08 (A21, A22), and E10 on 2026-04-15 (A27). I05, the Halden Leasing note, was also downgraded on 2026-04-15, but that is an instrument rating and E11 has no issuer rating.

**Q8.** E08. Its rating has been RD since 2026-07-08 (A22).

**Q9.** 12. Issuer ratings in force and not withdrawn: CV, E01, E02, E05, E06, E08, E09, E10, E12, E13, E14, E15. E07 is withdrawn (A19), and VD has none.

**Q10.** Depends. E05 is BB in foreign currency (non-investment grade) and BBB- in local currency (investment grade).

**Q11.** BBB+ (A36).

**Q12.** A- (A34).

**Q13.** 1. The only downgrade was on 2024-09-30 (A36).

**Q14.** None. E12's first rating is dated 2024-02-01 (A30).

**Q15.** A- (E10, A26).

**Q16.** No. It was BBB+ on 2025-01-01 and is BBB+ now. Only the watch and outlook status changed (A35, A33).

**Q17.** No. The 2026-09-03 action (A17) put E06 on Rating Watch Negative and the rating stayed at A-.

**Q18.** E06 (A17). E14's watch ended on 2026-05-01.

**Q19.** E01 (A03) and E09 (A25).

**Q20.** No. E07's rating was withdrawn on 2026-05-12 (A19), and no default rating is recorded for it.

**Q21.** E07. Its rating was withdrawn (WD, A19).

**Q22.** E08. It is the only entity with a default-grade rating (RD, A22).

**Q23.** F2 (A04).

**Q24.** Yes. E01's issuer rating is BBB (A03).

**Q25.** 5. The investment-grade instruments are I01 (BBB), I03 (A), I05 (BBB+), I06 (A-) and I07 (BBB-).

**Q26.** A+ (A40).

**Q27.** A- (I06, A42).

**Q28.** BBB+ (A38).

**Q29.** None. VD has no rating records.

**Q30.** E05 and E15. E05 is BB against a VD ceiling of BB, and E15 is A against a CV ceiling of A.

**Q31.** No. E05 and E15 are exactly at their ceilings, not above them.

**Q32.** E09.

**Q33.** E10, the guarantor of I05. I05 is rated BBB+ (A29), the same as E10's issuer rating.

**Q34.** No. E12 has no parent, and E10's ultimate parent is E09.

**Q35.** 3 (E09, E10, E11).

**Q36.** 2 (E02, E04).

**Q37.** 16 entity rows, after duplicate records were merged (E03 into E02, E17 into E10).

**Q38.** No. E06 (DE) and E13 (US) are separate entities with different LEIs.

**Q39.** A (A09).

**Q40.** 5. The GB issuers with an issuer rating on 2026-10-01 are E01, E02, E09, E12 and E14. E07 is withdrawn.

**Q41.** None. Brindle Capital is not in the data.

**Q42.** LU.

**Q43.** 1 (E10).

**Q44.** Yes. I07 has local_currency = yes and is denominated in XVD.

**Q45.** No. I07 is a local-currency obligation, and the ceiling applies to foreign-currency ratings. Its BBB- (A45) is therefore not capped by the BB ceiling.

**Q46.** No. E11 has only an instrument rating (I05) and no issuer rating.

**Q47.** None. I08 has no rating records.

**Q48.** 7. I01 to I07 have current ratings and I08 has none.

```json
{
"Q1": {"rating": "A-"},
"Q2": {"downgraded": "no"},
"Q3": {"investment_grade": "no", "rating": "BB+"},
"Q4": {"outlook": "POS"},
"Q5": {"risk_of": "E02", "rating": "A"},
"Q7": {"issuers": ["E08", "E10"]},
"Q8": {"entities": ["E08"]},
"Q9": {"count": 12},
"Q10": {"investment_grade": "depends"},
"Q11": {"rating": "BBB+"},
"Q12": {"rating": "A-"},
"Q13": {"count": 1},
"Q14": {"rating": "none"},
"Q15": {"rating": "A-"},
"Q16": {"changed": "no"},
"Q17": {"downgraded": "no"},
"Q18": {"issuers": ["E06"]},
"Q19": {"issuers": ["E01", "E09"]},
"Q20": {"in_default": "no"},
"Q21": {"entities": ["E07"]},
"Q22": {"entities": ["E08"]},
"Q23": {"rating": "F2"},
"Q24": {"investment_grade": "yes"},
"Q25": {"count": 5},
"Q26": {"rating": "A+"},
"Q27": {"rating": "A-"},
"Q28": {"rating": "BBB+"},
"Q29": {"rating": "none"},
"Q30": {"entities": ["E05", "E15"]},
"Q31": {"any": "no"},
"Q32": {"parent": "E09"},
"Q33": {"risk_of": "E10", "rating": "BBB+"},
"Q34": {"same_group": "no"},
"Q35": {"count": 3},
"Q36": {"count": 2},
"Q37": {"count": 16},
"Q38": {"same": "no"},
"Q39": {"rating": "A"},
"Q40": {"count": 5},
"Q41": {"rating": "none"},
"Q42": {"country": "LU"},
"Q43": {"count": 1},
"Q44": {"local_currency": "yes"},
"Q45": {"above_ceiling": "no"},
"Q46": {"issuer_rating": "no"},
"Q47": {"rating": "none"},
"Q48": {"count": 7}
}
```