D1 sql, run 4: the query session

← back to the run

3 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` (19 rows): entity_id, name, lei, country, entity_type, parent_id, source_system
- `instruments` (8 rows): instrument_id, description, issuer_id, guarantor_id, seniority, currency, maturity
- `rating_actions` (47 rows): action_id, date, rated_id, rating_type, ccy_basis, action, rating, outlook, watch, comment

## 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 ORDER BY entity_id;
```
```sql
SELECT * FROM instruments ORDER BY instrument_id;
```
```sql
SELECT * FROM rating_actions ORDER BY date, action_id;
```
Query results
Query 1:

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

Query 2:

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

Query 3:

| action_id | date | rated_id | rating_type | ccy_basis | action | rating | outlook | watch | comment |
|---|---|---|---|---|---|---|---|---|---|
| A34 | 2023-01-15 | E14 | LTIDR | FC | AS | A- | STA |  |  |
| A24 | 2023-05-01 | E09 | LTIDR | FC | AS | A | STA |  |  |
| A26 | 2023-05-01 | E10 | LTIDR | FC | AS | A- | STA |  | support from parent |
| A28 | 2023-06-01 | I05 | INST |  | AS | A- |  |  |  |
| A08 | 2023-11-01 | E02 | LTIDR | FC | AS | A | STA |  |  |
| A10 | 2023-11-01 | I03 | INST |  | AS | A |  |  |  |
| A37 | 2024-01-01 | CV | CC |  | AS | A |  |  |  |
| A38 | 2024-01-01 | CV | LTIDR | FC | AS | BBB+ | STA |  |  |
| A39 | 2024-01-01 | CV | LTIDR | LC | AS | A- | STA |  |  |
| A18 | 2024-01-10 | E07 | LTIDR | FC | AS | BB | STA |  |  |
| A30 | 2024-02-01 | E12 | LTIDR | FC | AS | BB- | STA |  |  |
| A40 | 2024-03-01 | E15 | LTIDR | LC | AS | A+ | STA |  |  |
| A41 | 2024-03-01 | E15 | LTIDR | FC | AS | A | STA |  |  |
| A42 | 2024-03-01 | I06 | INST |  | AS | A- |  |  |  |
| A01 | 2024-03-12 | E01 | LTIDR | FC | AS | A- | STA |  |  |
| A05 | 2024-03-12 | I01 | INST |  | AS | A- |  |  |  |
| A23 | 2024-03-12 | I02 | INST |  | AS | BBB |  |  |  |
| A43 | 2024-04-01 | E16 | LTIDR | FC | AS | BBB- | STA |  |  |
| A16 | 2024-05-01 | E06 | LTIDR | FC | AS | A- | STA |  |  |
| A20 | 2024-06-01 | E08 | LTIDR | FC | AS | B | STA |  |  |
| A32 | 2024-07-01 | E13 | LTIDR | FC | AS | BBB | STA |  |  |
| A36 | 2024-09-30 | E14 | LTIDR | FC | DG | BBB+ | STA |  |  |
| A46 | 2025-02-01 | E11 | CO |  | AS | BBB |  |  |  |
| A12 | 2025-04-01 | VD | CC |  | AS | BB |  |  |  |
| A13 | 2025-04-01 | E05 | LTIDR | LC | AS | BBB- | STA |  |  |
| A14 | 2025-04-01 | E05 | LTIDR | FC | AS | BB | STA |  |  |
| A15 | 2025-04-01 | I04 | INST |  | AS | BB |  |  |  |
| A45 | 2025-04-01 | I07 | INST |  | AS | BBB- |  |  |  |
| A02 | 2025-06-20 | E01 | LTIDR | FC | DG | BBB | STA |  | weaker cash flow after asset sale |
| A06 | 2025-06-20 | I01 | INST |  | DG | BBB |  |  |  |
| A07 | 2025-06-20 | I02 | INST |  | DG | BB+ |  |  |  |
| A31 | 2025-08-01 | E12 | LTIDR | FC | UG | BB | STA |  |  |
| A09 | 2025-09-15 | E03 | LTIDR | FC | AF | A | POS |  |  |
| A11 | 2025-09-15 | I03 | INST |  | AF | A |  |  |  |
| A35 | 2025-11-20 | E14 | LTIDR | FC | RW | BBB+ |  | RWN |  |
| A21 | 2026-01-20 | E08 | LTIDR | FC | DG | CCC |  |  |  |
| A03 | 2026-02-10 | E01 | LTIDR | FC | AF | BBB | NEG |  |  |
| A04 | 2026-02-10 | E01 | STIDR | FC | AF | F2 |  |  |  |
| A25 | 2026-03-01 | E09 | LTIDR | FC | AF | A | NEG |  |  |
| A27 | 2026-04-15 | E10 | LTIDR | FC | DG | BBB+ | STA |  |  |
| A29 | 2026-04-15 | I05 | INST |  | DG | BBB+ |  |  |  |
| A33 | 2026-05-01 | E14 | LTIDR | FC | AF | BBB+ | STA |  |  |
| A19 | 2026-05-12 | E07 | LTIDR | FC | WD | WD |  |  | commercial reasons |
| A44 | 2026-06-01 | E16 | LTIDR | FC | DG | BB+ | STA |  |  |
| A22 | 2026-07-08 | E08 | LTIDR | FC | DG | RD |  |  | distressed debt exchange completed |
| A47 | 2026-09-01 | I08 | INST |  | EX | A |  |  |  |
| A17 | 2026-09-03 | E06 | LTIDR | FC | RW | A- |  | RWN |  |

Run more queries, or give the final answers.
The model
**Q1.** A-. The last action before that date was A01 (2024-03-12, A-), and the downgrade A02 only came on 2025-06-20.

**Q2.** No. A03 (2026-02-10) affirmed Kestrel at BBB and only moved the outlook to Negative. The downgrade A02 was in 2025.

**Q3.** No. The 2031 note (I02, subordinated) was cut to BB+ by A07, which is sub-investment grade.

**Q4.** Positive. E03 shares E02's LEI, so it is the same entity, and A09 (2025-09-15) affirmed it at A with a POS outlook.

**Q5.** The risk is that of E02, rated A. I03 is issued by E04 but guaranteed by E02, and its rating is A (A11).

**Q6.** The foreign-currency rating is capped by Valdoria's Country Ceiling of BB (A12). The foreign-currency rating is BB (A14) and the local-currency rating is BBB- (A13).

**Q7.** E08, E10 and E16. The downgrades are A21 and A22 for E08, A27 for E10 and A44 for E16. I05's downgrade (A29) is an instrument action, so E11 is not counted.

**Q8.** E08. A22 moved it to RD (restricted default) on 2026-07-08. E07 was only withdrawn (A19).

**Q9.** 13. These are E01, E02 (E03 is the same entity), E05, E06, E08, E09, E10, E12, E13, E14, E15, E16 and CV. E07's rating is withdrawn, and E11 and VD have no LTIDR.

**Q10.** Depends. The local-currency rating is BBB- (investment grade, A13) and the foreign-currency rating is BB (not investment grade, A14).

**Q11.** BBB+. A36 downgraded it on 2024-09-30.

**Q12.** A-, from A34.

**Q13.** 1. Only A36 is a downgrade; A35 is a watch placement.

**Q14.** None. The first Halden Foods rating is A30, on 2024-02-01.

**Q15.** A-, from A26. The downgrade A27 came on 2026-04-15.

**Q16.** No. It was BBB+ from 2024-09-30 and is still BBB+ (A33 affirmed it).

**Q17.** No. A17 only placed E06's A- rating on Rating Watch Negative.

**Q18.** E06, from A17. E14's watch (A35) was cleared by A33.

**Q19.** E01 (A03) and E09 (A25). E06 is on watch, with no outlook shown.

**Q20.** No. A19 withdrew the rating for commercial reasons, and no default rating appears for E07.

**Q21.** E07, whose rating was withdrawn by A19.

**Q22.** E08, via A22 (RD).

**Q23.** F2 (A04).

**Q24.** Yes. The issuer rating is BBB (A03).

**Q25.** 5. These are I01 (BBB), I03 (A), I05 (BBB+), I06 (A-) and I07 (BBB-). I08's rating ended with A47 (EX). The data does not define EX, so I read it as ending the rating.

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

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

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

**Q29.** None. VD has only a Country Ceiling (A12, BB), not an issuer rating.

**Q30.** E15 and E05. E15's foreign-currency rating of A equals Corvenia's ceiling of A (A41, A37). E05's BB equals Valdoria's ceiling of BB (A14, A12).

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

**Q32.** E09. E11 has parent E10, and E10 has parent E09.

**Q33.** The risk is that of E10, rated BBB+. I05 is guaranteed by E10, and the rating is BBB+ after A27/A29.

**Q34.** No. E12 has no parent link to E09 or E10, and the similar name is not evidence of a group.

**Q35.** 3: E09, E10 and E11. E17 is a duplicate of E10.

**Q36.** 2: E02 and E04. E03 duplicates E02.

**Q37.** 17. Of the 19 rows, E03 duplicates E02 and E17 duplicates E10, going by the shared LEIs.

**Q38.** No. They have different LEIs and countries, and neither is the other's parent.

**Q39.** A, from A08 and the A09 affirmation under the same LEI.

**Q40.** 6: E01, E02, E09, E12, E14 and E16. E07's rating is withdrawn.

**Q41.** BB+ (A44). The entity's source system is QA, which may mean it is a test record.

**Q42.** DE, per E10. The duplicate E17 says LU, which conflicts with E10.

**Q43.** 0. The only LU row is E17, a duplicate of E10, which is domiciled in DE. This one is uncertain because of the conflict.

**Q44.** Yes. I07 is in XVD, which appears to be Valdoria's currency, and its BBB- matches the local-currency rating.

**Q45.** No. The ceiling applies to foreign-currency obligations, and this is a local-currency note.

**Q46.** No. E11 has only a credit opinion (A46) and an instrument rating, not an issuer rating.

**Q47.** None. A47 (EX, 2026-09-01) ended the rating, which was A before. This assumes EX means the rating ended.

**Q48.** 7. This is I01 to I07; I08 is excluded because of A47.

```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", "E16"]},
"Q8": {"entities": ["E08"]},
"Q9": {"count": 13},
"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": 17},
"Q38": {"same": "no"},
"Q39": {"rating": "A"},
"Q40": {"count": 6},
"Q41": {"rating": "BB+"},
"Q42": {"country": "DE"},
"Q43": {"count": 0},
"Q44": {"local_currency": "yes"},
"Q45": {"above_ceiling": "no"},
"Q46": {"issuer_rating": "no"},
"Q47": {"rating": "none"},
"Q48": {"count": 7}
}
```