D1 sql, run 3: the query session

← back to the run

28 queries1 failed7 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` (370 rows): entity_id, name, lei, country, entity_type, parent_id, source_system
- `instruments` (115 rows): instrument_id, description, issuer_id, guarantor_id, seniority, currency, maturity
- `rating_actions` (787 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
<invoke>
```sql
select * from entities order by entity_id limit 400;
```

```sql
select * from instruments order by instrument_id;
```

```sql
select distinct rating_type, ccy_basis, action, outlook, watch from rating_actions order by 1,2,3,4,5;
```
</invoke>
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 |
| E1001 | Tunod Steel SA | 3912003R00FP6CNV6210 | FR | CORP |  | RATINGS |
| E1002 | TUNOD STEEL SA | 3912003R00FP6CNV6210 | FR | CORP |  | RESEARCH |
| E1003 | Rilol Telecom plc | 3912009W4J483WB8PZ97 | GB | BANK |  | RATINGS |
| E1004 | Munem Retail SA | 969500IBYK0X2ZT52780 | ES | CORP |  | RATINGS |
| E1005 | Setan Airlines Inc | 815600JRN7AOE36KFR35 | US | CORP |  | RATINGS |
| E1006 | Soson Airlines Inc | 213800WSVEOAQ5HD4C43 | US | CORP | E1005 | RATINGS |
| E1007 | Golod Property plc | 815600N2UAHQREHHWF76 | GB | BANK |  | RATINGS |
| E1008 | Sotil Retail plc | 213800RPNJ2OSQ387M40 | GB | CORP |  | RATINGS |
| E1009 | Malam Chemicals Inc | 3912006EIY6TU9NVSC86 | US | CORP |  | RATINGS |
| E1010 | Buvir Industries Inc | 3912004R2GZJL49URX69 | US | CORP |  | RATINGS |
| E1011 | Falom Media Inc | 549300XX6U9N4Y7KPH74 | US | BANK |  | RATINGS |
| E1012 | Posad Industries SA | 9695002JIQI5QYDN0G98 | FR | CORP |  | RATINGS |
| E1013 | Pisol Pharma BV | 969500U072SAPPW32N81 | NL | BANK | E1004 | RATINGS |
| E1014 | Toral Utilities BV | 391200J700D8T2H18W16 | NL | CORP |  | RATINGS |
| E1015 | Civen Steel Inc | 815600JSNIJ4UFCBF662 | US | CORP |  | RATINGS |
| E1016 | Ponar Telecom SA | 5493008DQ96XI37KZG24 | ES | BANK |  | RATINGS |
| E1017 | Nisid Steel SA | 391200K600X7LWZTTM85 | FR | BANK |  | RATINGS |
| E1018 | Tosem Mining Inc | 549300SEMGL6OXLWHQ59 | US | CORP |  | RATINGS |
| E1019 | Losol Mining SA | 391200GSFO0F68KKUC67 | CV | CORP |  | RATINGS |
| E1020 | Finel Media AG | 549300FCSHHELSCZX562 | DE | CORP |  | RATINGS |
| E1021 | Niner Pharma plc | 391200KLG6G4KVIMIU52 | GB | CORP |  | RATINGS |
| E1022 | NINER PHARMA | 391200KLG6G4KVIMIU52 | GB | CORP |  | RESEARCH |
| E1023 | Heled Water plc | 3912006FHXTH5V6WNK07 | GB | CORP |  | RATINGS |
| E1024 | Susin Shipping BV | 3912005J04HB7X0GTN24 | NL | CORP |  | RATINGS |
| E1025 | Tulol Shipping SA | 2138007MIV2OS05PET94 | ES | BANK |  | RATINGS |
| E1026 | Vunam Water BV | 969500C8XYHXZBFMUO41 | NL | CORP |  | RATINGS |
| E1027 | Tesad Media Inc | 969500T86HNH5S920X18 | US | CORP |  | RATINGS |
| E1028 | Mutir Retail SA | 213800TJ32NARU0BI982 | VD | CORP |  | RATINGS |
| E1029 | Leson Telecom Inc | 8156008DPX4I9DNKWN26 | US | BANK |  | RATINGS |
| E1030 | LESON TELECOM INC | 8156008DPX4I9DNKWN26 | US | BANK |  | RESEARCH |
| E1031 | Kuvir Logistics SA | 969500GRHP48SQNEWH44 | ES | CORP |  | RATINGS |
| E1032 | Helom Chemicals BV | 2138006H9XCYN2P1K228 | NL | BANK |  | RATINGS |
| E1033 | Kunid Pharma SA | 213800Q84PS4FTJJB947 | ES | CORP | E1004 | RATINGS |
| E1034 | Tanad Capital SpA | 815600KLV84WAQGPSX27 | IT | CORP |  | RATINGS |
| E1035 | Kavod Utilities AG | 724500YHN51API4SE179 | DE | CORP |  | RATINGS |
| E1036 | Lilor Retail AG | 9695000N72OQ0Q07IW61 | DE | CORP |  | RATINGS |
| E1037 | Natil Retail SA | 391200OBAXI8590VQN12 | FR | CORP |  | RATINGS |
| E1038 | Lanon Telecom BV | 549300EZ4HXP0L5RAZ01 | NL | CORP |  | RATINGS |
| E1039 | Pulor Airlines SA | 969500HA9D5I7F73PW83 | CV | BANK |  | RATINGS |
| E1040 | Dorid Mining AG | 549300SPMD9MEMFWMR12 | DE | CORP |  | RATINGS |
| E1041 | Hiral Steel SA | 549300JU1O5MP1HSKQ01 | ES | CORP |  | RATINGS |
| E1042 | Rerod Steel BV | 391200LC6V921W096L49 | NL | CORP |  | RATINGS |
| E1043 | Vitom Property plc | 5493007IVTPIWJZLFF29 | GB | CORP |  | RATINGS |
| E1044 | Hesid Telecom Inc | 3912003Y7VZHUGN50755 | US | BANK |  | RATINGS |
| E1045 | Nesid Logistics Inc | 96950029VB162U3K1976 | US | BANK |  | RATINGS |
| E1046 | Ditin Shipping Inc | 549300ZM08IADSAK3L87 | US | BANK | E1026 | RATINGS |
| E1047 | Vaved Pharma plc | 391200WGA8OE30KZUD08 | GB | CORP | E1020 | RATINGS |
| E1048 | Lised Pharma AG | 9695000T21G05UQMGF10 | DE | CORP |  | RATINGS |
| E1049 | Paser Utilities plc | 391200R2EH7FELZFOV27 | GB | CORP |  | RATINGS |
(310 more rows not shown)

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 |
| I1001 | Soson Airlines 5.50% notes due 2031 | E1006 |  | SUB | USD | 2035-06-30 |
| I1002 | Golod Property 8.75% notes due 2031 | E1007 |  | SU | USD | 2033-06-30 |
| I1003 | Sotil Retail 3.00% notes due 2031 | E1008 |  | SU | GBP | 2034-06-30 |
| I1004 | Malam Chemicals 2.25% notes due 2035 | E1009 |  | SU | USD | 2028-06-30 |
| I1005 | Posad Industries 4.00% notes due 2033 | E1012 |  | SU | EUR | 2031-06-30 |
| I1006 | Pisol Pharma 4.75% notes due 2030 | E1013 |  | SUB | USD | 2030-06-30 |
| I1007 | Toral Utilities 7.75% notes due 2028 | E1014 |  | SU | EUR | 2033-06-30 |
| I1008 | Ponar Telecom 4.75% notes due 2035 | E1016 |  | SU | EUR | 2033-06-30 |
| I1009 | Tosem Mining 2.75% notes due 2031 | E1018 |  | SUB | USD | 2036-06-30 |
| I1010 | Finel Media 6.50% notes due 2035 | E1020 |  | SU | EUR | 2036-06-30 |
| I1011 | Niner Pharma 3.25% notes due 2029 | E1021 |  | SU | USD | 2035-06-30 |
| I1012 | Heled Water 6.25% notes due 2030 | E1023 |  | SU | GBP | 2031-06-30 |
| I1013 | Kuvir Logistics 2.00% notes due 2027 | E1031 |  | SU | EUR | 2027-06-30 |
| I1014 | Kavod Utilities 2.50% notes due 2032 | E1035 |  | SU | USD | 2036-06-30 |
| I1015 | Lanon Telecom 4.75% notes due 2033 | E1038 |  | SUB | EUR | 2032-06-30 |
| I1016 | Hiral Steel 6.00% notes due 2035 | E1041 |  | SU | USD | 2034-06-30 |
| I1017 | Lised Pharma 4.50% notes due 2036 | E1048 |  | SU | EUR | 2029-06-30 |
| I1018 | Paser Utilities 3.75% notes due 2027 | E1049 |  | SUB | GBP | 2034-06-30 |
| I1019 | Sunar Holdings 8.50% notes due 2036 | E1050 |  | SUB | USD | 2034-06-30 |
| I1020 | Witad Steel 5.00% notes due 2033 | E1052 |  | SU | EUR | 2027-06-30 |
| I1021 | Duver Shipping 8.50% notes due 2032 | E1056 |  | SU | EUR | 2030-06-30 |
| I1022 | Levem Foods 6.50% notes due 2035 | E1067 |  | SUB | EUR | 2030-06-30 |
| I1023 | Mored Utilities 4.25% notes due 2032 | E1071 |  | SUB | USD | 2033-06-30 |
| I1024 | Ganed Holdings 5.75% notes due 2035 | E1077 |  | SU | EUR | 2032-06-30 |
| I1025 | Menir Shipping 7.50% notes due 2028 | E1078 |  | SUB | EUR | 2034-06-30 |
| I1026 | Nevar Property 6.75% notes due 2036 | E1079 |  | SU | GBP | 2028-06-30 |
| I1027 | Gilen Capital 2.00% notes due 2031 | E1082 |  | SUB | USD | 2034-06-30 |
| I1028 | Givim Mining 5.75% notes due 2036 | E1085 |  | SU | EUR | 2034-06-30 |
| I1029 | Gorar Steel 7.25% notes due 2033 | E1086 |  | SUB | USD | 2035-06-30 |
| I1030 | Vitid Holdings 5.75% notes due 2032 | E1087 |  | SU | EUR | 2034-06-30 |
| I1031 | Koved Holdings 2.50% notes due 2032 | E1088 |  | SUB | EUR | 2033-06-30 |
| I1032 | Getel Utilities 7.25% notes due 2033 | E1090 |  | SU | USD | 2032-06-30 |
| I1033 | Vavam Pharma 8.75% notes due 2032 | E1103 |  | SUB | USD | 2032-06-30 |
| I1034 | Kisil Logistics 8.50% notes due 2031 | E1108 |  | SU | EUR | 2033-06-30 |
| I1035 | Verod Logistics 3.00% notes due 2035 | E1114 |  | SU | GBP | 2029-06-30 |
| I1036 | Piren Foods 2.50% notes due 2030 | E1115 |  | SU | USD | 2033-06-30 |
| I1037 | Reter Shipping 8.00% notes due 2028 | E1118 |  | SU | EUR | 2027-06-30 |
| I1038 | Conan Capital 4.75% notes due 2033 | E1131 |  | SU | EUR | 2031-06-30 |
| I1039 | Larid Steel 8.50% notes due 2028 | E1141 |  | SU | GBP | 2033-06-30 |
| I1040 | Woner Media 5.75% notes due 2027 | E1143 |  | SUB | EUR | 2027-06-30 |
| I1041 | Kanim Pharma 3.25% notes due 2033 | E1145 |  | SUB | EUR | 2036-06-30 |
| I1042 | Daren Mining 5.75% notes due 2030 | E1147 |  | SU | EUR | 2035-06-30 |
| I1043 | Honel Shipping 4.50% notes due 2028 | E1149 |  | SUB | EUR | 2029-06-30 |
| I1044 | Wavad Foods 6.75% notes due 2035 | E1155 |  | SU | USD | 2036-06-30 |
| I1045 | Ruven Airlines 5.75% notes due 2032 | E1156 |  | SUB | EUR | 2036-06-30 |
| I1046 | Diled Steel 8.75% notes due 2027 | E1160 |  | SU | EUR | 2029-06-30 |
| I1047 | Wunam Telecom 5.25% notes due 2032 | E1162 |  | SU | EUR | 2029-06-30 |
| I1048 | Wenar Water 8.25% notes due 2028 | E1163 |  | SUB | EUR | 2028-06-30 |
| I1049 | Ranim Shipping 8.00% notes due 2028 | E1166 |  | SUB | USD | 2036-06-30 |
| I1050 | Fivan Holdings 2.25% notes due 2035 | E1168 |  | SU | EUR | 2027-06-30 |
| I1051 | Molar Shipping 3.25% notes due 2031 | E1188 |  | SU | EUR | 2028-06-30 |
| I1052 | Divid Property 4.25% notes due 2033 | E1189 |  | SUB | GBP | 2032-06-30 |
(55 more rows not shown)

Query 3:

| rating_type | ccy_basis | action | outlook | watch |
|---|---|---|---|---|
| CC |  | AS |  |  |
| CO |  | AS |  |  |
| INST |  | AF |  |  |
| INST |  | AS |  |  |
| INST |  | DG |  |  |
| INST |  | EX |  |  |
| LTIDR | FC | AF | NEG |  |
| LTIDR | FC | AF | POS |  |
| LTIDR | FC | AF | STA |  |
| LTIDR | FC | AS | STA |  |
| LTIDR | FC | DG | NEG |  |
| LTIDR | FC | DG | POS |  |
| LTIDR | FC | DG | STA |  |
| LTIDR | FC | DG |  |  |
| LTIDR | FC | RW |  | RWN |
| LTIDR | FC | UG | NEG |  |
| LTIDR | FC | UG | POS |  |
| LTIDR | FC | UG | STA |  |
| LTIDR | FC | WD |  |  |
| LTIDR | LC | AF | POS |  |
| LTIDR | LC | AF | STA |  |
| LTIDR | LC | AS | STA |  |
| LTIDR | LC | DG | NEG |  |
| LTIDR | LC | DG | POS |  |
| LTIDR | LC | DG | STA |  |
| LTIDR | LC | RW |  | RWN |
| LTIDR | LC | UG | POS |  |
| LTIDR | LC | UG | STA |  |
| LTIDR | LC | WD |  |  |
| STIDR | FC | AF |  |  |

Run more queries, or give the final answers.
The model
```sql
select * from entities where entity_id in ('CV','VD') or entity_id not like 'E1%' order by entity_id;
```

```sql
select * from rating_actions where rated_id in ('E01','E02','E03','E04','E05','E06','E07','E08','E09','E10','E11','E12','E13','E14','E15','E16','E17','E18','E19','E20','CV','VD','I01','I02','I03','I04','I05','I06','I07','I08') order by rated_id, date;
```

```sql
select * from instruments where instrument_id not like 'I1%' or issuer_id in ('E11','E12','E13','E14','E15','E16');
```
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 |
| VD | Republic of Valdoria |  | VD | SOV |  | RATINGS |

Query 2:

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

Query 3:

| 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 |

Run more queries, or give the final answers.
The model
```sql
select * from entities where entity_id in ('E10','E11','E12','E13','E14','E15','E16','E17','E18','E19','E20','E21','E22') or name ilike '%halden%' or name ilike '%marlow%' or name ilike '%brindle%' or name ilike '%orrin%' or name ilike '%northwind%' or name ilike '%corvenia%' or name ilike '%valdoria%' or country in ('LU') or parent_id is not null order by entity_id;
```

```sql
select * from rating_actions where rating_type in ('CC','CO') or action in ('WD','EX') or rating in ('RD','D','SD') or watch is not null order by date;
```

```sql
select count(*), count(distinct lei), count(distinct entity_id) from entities;
```

```sql
select entity_type, source_system, count(*) from entities group by 1,2;
```
Query results
Query 1:

| entity_id | name | lei | country | entity_type | parent_id | source_system |
|---|---|---|---|---|---|---|
| CV | Republic of Corvenia |  | CV | SOV |  | 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 |
| E09 | Halden Group plc | 815600ASM9EHDG931T89 | GB | CORP |  | RATINGS |
| E10 | Halden Bank AG | 391200QYPVFF2O9K2039 | DE | BANK | E09 | RATINGS |
| E1006 | Soson Airlines Inc | 213800WSVEOAQ5HD4C43 | US | CORP | E1005 | RATINGS |
| E1013 | Pisol Pharma BV | 969500U072SAPPW32N81 | NL | BANK | E1004 | RATINGS |
| E1033 | Kunid Pharma SA | 213800Q84PS4FTJJB947 | ES | CORP | E1004 | RATINGS |
| E1046 | Ditin Shipping Inc | 549300ZM08IADSAK3L87 | US | BANK | E1026 | RATINGS |
| E1047 | Vaved Pharma plc | 391200WGA8OE30KZUD08 | GB | CORP | E1020 | RATINGS |
| E1059 | Kelim Media SA | 549300CRXZL5I1OT6L14 | CV | CORP | E1015 | RATINGS |
| E1066 | Lolil Industries SA | 213800VQSNQ2434DKS91 | ES | CORP | E1004 | RATINGS |
| E1075 | Nilim Industries Inc | 815600GT8SEYXSQI7W78 | US | CORP | E1071 | RATINGS |
| E1089 | Hanir Airlines SA | 969500WJX7JXMZXN4L42 | GR | CORP | E1078 | RATINGS |
| E1095 | Hunel Foods Inc | 549300YCPCEYTT7UCP57 | US | CORP | E1027 | RATINGS |
| E1098 | Wirim Water Inc | 724500HD5AQ2MDSXXU69 | US | CORP | E1006 | RATINGS |
| E11 | Halden Leasing SA | 549300XBZH4ULO9MQV55 | FR | FINSUB | E10 | RATINGS |
| E1101 | Doror Telecom SA | 815600YUVYKAXDN9LE93 | VD | CORP | E1083 | RATINGS |
| E1110 | Rinar Industries SA | 815600DZBIB9VS57NE44 | ES | CORP | E1007 | RATINGS |
| E1114 | Verod Logistics plc | 213800VNSK3FDUWI9Q67 | GB | CORP | E1063 | RATINGS |
| E1149 | Honel Shipping BV | 969500DV6LOBOACJKE42 | NL | CORP | E1013 | RATINGS |
| E1174 | Fivel Retail SpA | 724500P05MC40B0POA10 | IT | BANK | E1073 | RATINGS |
| E1177 | Kiver Capital AG | 213800J4ER8QI0XDZ847 | DE | BANK | E1010 | RATINGS |
| E1179 | Cotan Foods SA | 391200USHZVHBK9FHP01 | ES | CORP | E1162 | RATINGS |
| E1183 | Danad Pharma plc | 96950015W720OD9VIA28 | GB | CORP | E1025 | RATINGS |
| E1191 | Boler Steel SA | 815600G5CMC2QEQUCG23 | FR | CORP | E1177 | RATINGS |
| E1197 | Kaval Property plc | 8156000IN4HMEEM2ON82 | GB | CORP | E1066 | RATINGS |
| E12 | Halden Foods Ltd | 213800IJDL4OJ4DG5T19 | GB | CORP |  | RATINGS |
| E1215 | Penen Retail Inc | 8156003V8NY694JQQA11 | US | BANK | E1063 | RATINGS |
| E1228 | Cevad Chemicals plc | 724500JFK718P3DNW233 | GB | CORP | E1023 | RATINGS |
| E1233 | Kavid Industries AG | 3912001DEUC7UPZYE471 | DE | CORP | E1198 | RATINGS |
| E1248 | Hivod Mining Inc | 213800XN4WOS9M0UP985 | US | CORP | E1107 | RATINGS |
| E1271 | Rarid Logistics AG | 213800M91M3NKSWT8K97 | DE | CORP | E1071 | RATINGS |
| E1273 | Furer Property SA | 724500Y582IZ7KJ6AG72 | ES | CORP | E1074 | RATINGS |
| E1275 | Fusin Steel Inc | 815600G1ZFK3SU6EZU96 | US | CORP | E1189 | RATINGS |
| E1276 | Nevil Holdings SpA | 2138005AK9MHXT35J172 | IT | CORP | E1074 | RATINGS |
| E1292 | Bavon Industries plc | 549300RN36RWXRZPV988 | GB | CORP | E1061 | RATINGS |
| E1293 | Datod Airlines plc | 391200BREGDXY5M1LW07 | GB | CORP | E1166 | RATINGS |
| E13 | Orrin Bancorp Inc | 815600O8X8K2F154N214 | US | BANK |  | RATINGS |
| E1315 | Wetid Shipping AG | 391200G0CPKPNGKWC253 | DE | CORP | E1278 | RATINGS |
| E1325 | Poval Chemicals Finance SA | 9695001YLTVXK1L24J01 | FR | FINSUB | E1084 | RATINGS |
| E1326 | Witad Steel Finance BV | 969500WJEQ7O6V8P8X79 | FR | FINSUB | E1052 | RATINGS |
| E1327 | Nuner Holdings Finance plc | 391200SWQKZG1IRLG226 | GB | FINSUB | E1119 | RATINGS |
| E1328 | Palad Mining Finance BV | 969500NW5R0G6TCAZA92 | GB | FINSUB | E1244 | RATINGS |
| E1329 | Ganen Shipping Finance plc | 549300ZZB6Z4QUIPZW48 | FR | FINSUB | E1069 | RATINGS |
| E1330 | Niner Pharma Finance SA | 969500PPIIF0MLO97E32 | NL | FINSUB | E1021 | RATINGS |
| E1331 | Tulol Shipping Finance BV | 391200D59Z1B4XWDGA48 | FR | FINSUB | E1025 | RATINGS |
| E1332 | Sanin Mining Finance SA | 21380077GIA72K258C76 | FR | FINSUB | E1068 | RATINGS |
| E1333 | Gilen Capital Finance plc | 213800HVPSP99Z2KCJ88 | NL | FINSUB | E1082 | RATINGS |
| E1334 | Votim Industries Finance BV | 3912005LQY8PFMP9D487 | FR | FINSUB | E1260 | RATINGS |
| E1335 | Belor Telecom Finance plc | 9695001Q1J0GREF1Y798 | NL | FINSUB | E1234 | RATINGS |
| E1336 | Navor Holdings Finance SA | 391200G55M6O27UJS152 | GB | FINSUB | E1176 | RATINGS |
| E1337 | Lanon Telecom Finance plc | 391200EERFGANN46Y270 | GB | FINSUB | E1038 | RATINGS |
| E1338 | Hivor Industries Finance BV | 724500WX98LDWMIZLF21 | GB | FINSUB | E1073 | RATINGS |
| E1339 | Wivin Airlines Finance SA | 724500Y59GQFHLXXCT69 | NL | FINSUB | E1241 | RATINGS |
| E14 | Marlow Utilities plc | 3912005AH2C1I9YF8106 | GB | CORP |  | RATINGS |
| E15 | Corvenia Power SA | 213800PBQVHVBBH6GV02 | CV | CORP |  | RATINGS |
(3 more rows not shown)

Query 2:

| action_id | date | rated_id | rating_type | ccy_basis | action | rating | outlook | watch | comment |
|---|---|---|---|---|---|---|---|---|---|
| A1076 | 2022-05-07 | E1037 | LTIDR | FC | RW | A |  | RWN |  |
| A1084 | 2023-04-08 | E1041 | LTIDR | FC | RW | A+ |  | RWN |  |
| A1095 | 2023-04-15 | E1048 | LTIDR | FC | WD | WD |  |  | commercial reasons |
| A1356 | 2023-07-26 | E1166 | LTIDR | FC | WD | WD |  |  | commercial reasons |
| A1427 | 2023-09-02 | E1203 | LTIDR | FC | RW | BBB+ |  | RWN |  |
| A1362 | 2023-10-12 | E1168 | LTIDR | FC | RW | BBB- |  | RWN |  |
| A1685 | 2023-10-15 | E1320 | LTIDR | FC | WD | WD |  |  | commercial reasons |
| A1422 | 2023-11-03 | E1200 | LTIDR | FC | WD | WD |  |  | commercial reasons |
| A1214 | 2023-11-05 | E1099 | LTIDR | FC | RW | BB+ |  | RWN |  |
| A1455 | 2023-11-12 | E1216 | LTIDR | FC | RW | BB+ |  | RWN |  |
| A1570 | 2023-12-15 | E1267 | LTIDR | FC | RW | A- |  | RWN |  |
| A37 | 2024-01-01 | CV | CC |  | AS | A |  |  |  |
| A1190 | 2024-01-16 | E1088 | LTIDR | FC | RW | B+ |  | RWN |  |
| A1041 | 2024-02-08 | E1019 | LTIDR | LC | RW | BBB- |  | RWN |  |
| A1328 | 2024-02-13 | E1153 | LTIDR | FC | RW | B+ |  | RWN |  |
| A1042 | 2024-03-20 | E1019 | LTIDR | LC | RW | BBB- |  | RWN |  |
| A1085 | 2024-04-09 | E1041 | LTIDR | FC | WD | WD |  |  | commercial reasons |
| A1522 | 2024-04-18 | E1244 | LTIDR | FC | WD | WD |  |  | commercial reasons |
| A1262 | 2024-04-24 | E1121 | LTIDR | FC | RW | A |  | RWN |  |
| A1161 | 2024-04-28 | E1076 | LTIDR | FC | WD | WD |  |  | commercial reasons |
| A1564 | 2024-05-18 | E1264 | LTIDR | FC | RW | B+ |  | RWN |  |
| A1268 | 2024-06-15 | E1124 | LTIDR | FC | WD | WD |  |  | commercial reasons |
| A1676 | 2024-06-26 | E1314 | LTIDR | FC | RW | BBB |  | RWN |  |
| A1680 | 2024-07-07 | E1316 | LTIDR | FC | WD | WD |  |  | commercial reasons |
| A1708 | 2024-08-17 | E1333 | CO |  | AS | BBB+ |  |  |  |
| A1442 | 2024-09-09 | E1210 | LTIDR | FC | RW | BB |  | RWN |  |
| A1682 | 2024-09-11 | E1317 | LTIDR | FC | RW | BB |  | RWN |  |
| A1233 | 2024-10-16 | E1107 | LTIDR | FC | WD | WD |  |  | commercial reasons |
| A1263 | 2024-10-23 | E1121 | LTIDR | FC | WD | WD |  |  | commercial reasons |
| A1594 | 2024-11-17 | E1279 | LTIDR | FC | WD | WD |  |  | commercial reasons |
| A1296 | 2024-12-26 | E1138 | LTIDR | FC | WD | WD |  |  | commercial reasons |
| A1692 | 2025-01-06 | E1323 | LTIDR | FC | RW | AA- |  | RWN |  |
| A1387 | 2025-01-06 | E1181 | LTIDR | FC | RW | A- |  | RWN |  |
| A1138 | 2025-01-12 | E1063 | LTIDR | FC | WD | WD |  |  | commercial reasons |
| A1410 | 2025-01-20 | E1194 | LTIDR | FC | RW | A |  | RWN |  |
| A1496 | 2025-01-24 | E1233 | LTIDR | FC | WD | WD |  |  | commercial reasons |
| A46 | 2025-02-01 | E11 | CO |  | AS | BBB |  |  |  |
| A1206 | 2025-02-18 | E1095 | LTIDR | FC | RW | A- |  | RWN |  |
| A1136 | 2025-03-28 | E1062 | LTIDR | FC | WD | WD |  |  | commercial reasons |
| A12 | 2025-04-01 | VD | CC |  | AS | BB |  |  |  |
| A1022 | 2025-04-03 | E1012 | LTIDR | FC | RW | BB |  | RWN |  |
| A1134 | 2025-06-06 | E1061 | LTIDR | FC | RW | A |  | RWN |  |
| A1473 | 2025-06-12 | E1225 | LTIDR | FC | WD | WD |  |  | commercial reasons |
| A1700 | 2025-06-13 | E1327 | CO |  | AS | BBB- |  |  |  |
| A1664 | 2025-06-19 | E1308 | LTIDR | FC | WD | WD |  |  | commercial reasons |
| A1704 | 2025-06-27 | E1330 | CO |  | AS | BB+ |  |  |  |
| A1251 | 2025-06-28 | E1115 | LTIDR | FC | WD | WD |  |  | commercial reasons |
| A1026 | 2025-07-09 | E1013 | LTIDR | FC | RW | BB- |  | RWN |  |
| A1272 | 2025-07-10 | E1126 | LTIDR | FC | RW | BB |  | RWN |  |
| A1002 | 2025-07-20 | E1002 | LTIDR | FC | WD | WD |  |  | commercial reasons |
| A1180 | 2025-08-02 | E1084 | LTIDR | FC | WD | WD |  |  | commercial reasons |
| A1230 | 2025-08-10 | E1106 | LTIDR | LC | WD | WD |  |  | commercial reasons |
| A1317 | 2025-08-12 | E1146 | LTIDR | FC | RW | BB |  | RWN |  |
| A1540 | 2025-08-13 | E1254 | LTIDR | FC | WD | WD |  |  | commercial reasons |
| A1199 | 2025-08-19 | E1091 | LTIDR | FC | RW | A |  | RWN |  |
| A1284 | 2025-08-24 | E1132 | LTIDR | FC | RW | B+ |  | RWN |  |
| A1555 | 2025-09-05 | E1260 | LTIDR | FC | RW | BBB- |  | RWN |  |
| A1514 | 2025-09-11 | E1242 | LTIDR | FC | RW | BBB |  | RWN |  |
| A1298 | 2025-09-15 | E1140 | LTIDR | FC | WD | WD |  |  | commercial reasons |
| A1287 | 2025-10-11 | E1133 | LTIDR | FC | RW | B+ |  | RWN |  |
(47 more rows not shown)

Query 3:

| count_star() | count(DISTINCT lei) | count(DISTINCT entity_id) |
|---|---|---|
| 370 | 342 | 370 |

Query 4:

| entity_type | source_system | count_star() |
|---|---|---|
| BANK | RATINGS | 56 |
| CORP | QA | 13 |
| FINSUB | RATINGS | 17 |
| CORP | RATINGS | 256 |
| SOV | RATINGS | 2 |
| CORP | RESEARCH | 21 |
| BANK | RESEARCH | 5 |

Run more queries, or give the final answers.
The model
<invoke>
<parameter name="sql">select * from entities where entity_id in ('E16','E17','E18','E19','E20','E21') or name ilike '%brindle%' or country in ('LU') order by entity_id;</parameter>
</invoke>
```sql
select * from entities where entity_id in ('E16','E17','E18','E19','E20','E21') or name ilike '%brindle%' or country='LU' order by entity_id;
```

```sql
select count(*) filter (where lei is null) nulls, count(*) filter (where lei='') empties, count(distinct nullif(lei,'')) dl from entities;
```

```sql
with s as (select *, row_number() over (partition by rated_id, rating_type, coalesce(ccy_basis,'') order by date desc, action_id desc) rn from rating_actions where date<='2026-10-01' and rating_type in ('LTIDR')) select rated_id, ccy_basis, date, action, rating, outlook, watch from s where rn=1 and action<>'WD' and (rating in ('RD','D','SD') or watch='RWN' or outlook='NEG' or rated_id like 'E__' or rated_id in ('CV','VD')) order by rated_id;
```

```sql
select a.rated_id, e.name, e.country, a.date, a.ccy_basis, a.action, a.rating, a.outlook from rating_actions a left join entities e on e.entity_id=a.rated_id where a.rating_type='LTIDR' and a.action='DG' and a.date between '2026-01-01' and '2026-12-31' order by a.rated_id;
```

```sql
select a.rated_id, a.date, a.rating, a.action, a.comment from rating_actions a where rating in ('RD','D','SD') order by 1,2;
```

### user


<invoke>
<parameter name="sql">select 1</parameter>
</invoke>
Query results
Query 1:

| entity_id | name | lei | country | entity_type | parent_id | source_system |
|---|---|---|---|---|---|---|
| E16 | Brindle Capital Ltd | 5493003Z3PXXR7KNFM81 | GB | CORP |  | QA |
| E17 | HALDEN BANK | 391200QYPVFF2O9K2039 | LU | BANK |  | RESEARCH |

Query 2 failed: Parser Error: syntax error at or near "nulls"

Query 3:

| rated_id | ccy_basis | date | action | rating | outlook | watch |
|---|---|---|---|---|---|---|
| CV | LC | 2024-01-01 | AS | A- | STA |  |
| CV | FC | 2024-01-01 | AS | BBB+ | STA |  |
| E01 | FC | 2026-02-10 | AF | BBB | NEG |  |
| E02 | FC | 2023-11-01 | AS | A | STA |  |
| E03 | FC | 2025-09-15 | AF | A | POS |  |
| E05 | FC | 2025-04-01 | AS | BB | STA |  |
| E05 | LC | 2025-04-01 | AS | BBB- | STA |  |
| E06 | FC | 2026-09-03 | RW | A- |  | RWN |
| E08 | FC | 2026-07-08 | DG | RD |  |  |
| E09 | FC | 2026-03-01 | AF | A | NEG |  |
| E10 | FC | 2026-04-15 | DG | BBB+ | STA |  |
| E1005 | FC | 2025-08-02 | DG | BB | NEG |  |
| E1006 | FC | 2026-06-17 | RW | AA |  | RWN |
| E1013 | FC | 2025-07-09 | RW | BB- |  | RWN |
| E1019 | LC | 2024-03-20 | RW | BBB- |  | RWN |
| E1029 | FC | 2025-08-08 | UG | A- | NEG |  |
| E1034 | FC | 2026-05-02 | DG | BBB+ | NEG |  |
| E1037 | FC | 2022-05-07 | RW | A |  | RWN |
| E1039 | FC | 2025-12-09 | RW | A |  | RWN |
| E1046 | FC | 2025-05-28 | UG | AA- | NEG |  |
| E1055 | FC | 2024-12-04 | UG | BBB- | NEG |  |
| E1056 | FC | 2023-01-01 | DG | A+ | NEG |  |
| E1059 | LC | 2026-02-23 | RW | BB- |  | RWN |
| E1060 | FC | 2025-02-16 | AF | BB- | NEG |  |
| E1061 | FC | 2025-06-06 | RW | A |  | RWN |
| E1064 | FC | 2026-06-03 | UG | A- | NEG |  |
| E1066 | FC | 2026-05-03 | RW | A- |  | RWN |
| E1072 | FC | 2026-02-07 | AF | BB- | NEG |  |
| E1079 | FC | 2024-01-26 | AF | BB+ | NEG |  |
| E1080 | FC | 2026-02-14 | DG | A- | NEG |  |
| E1088 | FC | 2024-01-16 | RW | B+ |  | RWN |
| E1098 | FC | 2026-04-28 | RW | BBB- |  | RWN |
| E1099 | FC | 2023-11-05 | RW | BB+ |  | RWN |
| E1105 | FC | 2024-01-13 | UG | A+ | NEG |  |
| E1109 | FC | 2025-12-25 | RW | A+ |  | RWN |
| E1118 | FC | 2025-07-14 | DG | BB+ | NEG |  |
| E1126 | FC | 2025-07-10 | RW | BB |  | RWN |
| E1132 | FC | 2025-08-24 | RW | B+ |  | RWN |
| E1133 | FC | 2025-10-11 | RW | B+ |  | RWN |
| E1146 | FC | 2025-08-12 | RW | BB |  | RWN |
| E1158 | FC | 2026-08-14 | AF | BBB | NEG |  |
| E1161 | FC | 2026-07-28 | DG | B | NEG |  |
| E1168 | FC | 2023-10-12 | RW | BBB- |  | RWN |
| E1181 | FC | 2025-01-06 | RW | A- |  | RWN |
| E1188 | FC | 2024-09-05 | UG | BB- | NEG |  |
| E1190 | FC | 2025-05-24 | UG | BBB | NEG |  |
| E1194 | FC | 2025-01-20 | RW | A |  | RWN |
| E12 | FC | 2025-08-01 | UG | BB | STA |  |
| E1203 | FC | 2023-09-02 | RW | BBB+ |  | RWN |
| E1210 | FC | 2024-09-09 | RW | BB |  | RWN |
| E1211 | FC | 2024-09-26 | AF | BBB- | NEG |  |
| E1228 | FC | 2026-06-28 | DG | BB+ | NEG |  |
| E1238 | FC | 2026-07-27 | RW | AA- |  | RWN |
| E1242 | FC | 2025-09-11 | RW | BBB |  | RWN |
| E1248 | FC | 2026-05-02 | AF | A- | NEG |  |
| E1260 | FC | 2025-09-05 | RW | BBB- |  | RWN |
| E1262 | FC | 2024-10-13 | AF | B+ | NEG |  |
| E1263 | FC | 2026-06-16 | DG | BBB- | NEG |  |
| E1264 | FC | 2024-05-18 | RW | B+ |  | RWN |
| E1266 | FC | 2026-07-20 | RW | BBB |  | RWN |
(23 more rows not shown)

Query 4:

| rated_id | name | country | date | ccy_basis | action | rating | outlook |
|---|---|---|---|---|---|---|---|
| E08 | Saxby Shipping SA | GR | 2026-07-08 | FC | DG | RD |  |
| E08 | Saxby Shipping SA | GR | 2026-01-20 | FC | DG | CCC |  |
| E10 | Halden Bank AG | DE | 2026-04-15 | FC | DG | BBB+ | STA |
| E1034 | Tanad Capital SpA | IT | 2026-05-02 | FC | DG | BBB+ | NEG |
| E1051 | Kenar Water SA | GR | 2026-06-01 | FC | DG | A+ | POS |
| E1051 | Kenar Water SA | GR | 2026-04-05 | FC | DG | A+ | NEG |
| E1053 | Soter Water SA | ES | 2026-03-20 | FC | DG | BB | NEG |
| E1057 | Batan Foods plc | GB | 2026-06-25 | FC | DG | BB | STA |
| E1058 | Wasil Shipping SA | GR | 2026-07-14 | FC | DG | BBB- | POS |
| E1064 | Renil Media BV | NL | 2026-03-04 | FC | DG | BBB+ | STA |
| E1080 | Gatad Property Inc | US | 2026-02-14 | FC | DG | A- | NEG |
| E1093 | Nulil Airlines plc | GB | 2026-07-25 | FC | DG | B | STA |
| E1112 | Calem Logistics Inc | US | 2026-02-20 | FC | DG | BBB | POS |
| E1144 | Witan Logistics SA | CV | 2026-06-06 | FC | DG | B+ | POS |
| E1151 | Nunan Media SA | ES | 2026-01-26 | FC | DG | BBB | POS |
| E1159 | Benem Property AG | DE | 2026-06-16 | FC | DG | BBB+ | POS |
| E1161 | DILED STEEL SA | FR | 2026-07-28 | FC | DG | B | NEG |
| E1163 | Wenar Water SpA | IT | 2026-03-19 | FC | DG | BB+ | POS |
| E1167 | Fitad Foods BV | NL | 2026-09-07 | FC | DG | BB | STA |
| E1170 | SEREN TELECOM | GB | 2026-08-16 | FC | DG | BB- | STA |
| E1186 | Toren Capital AG | DE | 2026-01-04 | FC | DG | BBB+ | STA |
| E1213 | Winim Mining SA | FR | 2026-02-13 | FC | DG | A- | STA |
| E1213 | Winim Mining SA | FR | 2026-06-16 | FC | DG | BBB+ | POS |
| E1228 | Cevad Chemicals plc | GB | 2026-06-28 | FC | DG | BB+ | NEG |
| E1229 | Fetam Mining SA | CV | 2026-06-02 | FC | DG | BB+ | STA |
| E1229 | Fetam Mining SA | CV | 2026-05-06 | FC | DG | BB | STA |
| E1243 | Herar Foods SA | CV | 2026-01-13 | FC | DG | BB | STA |
| E1255 | Melan Holdings SA | ES | 2026-01-19 | FC | DG | BBB+ | STA |
| E1263 | Sotin Property Inc | US | 2026-03-03 | FC | DG | BBB | STA |
| E1263 | Sotin Property Inc | US | 2026-06-16 | FC | DG | BBB- | NEG |
| E1285 | Laril Retail plc | GB | 2026-02-17 | FC | DG | A | POS |
| E1290 | Nural Water plc | GB | 2026-08-16 | FC | DG | B | POS |
| E1294 | Runor Media SpA | IT | 2026-07-11 | FC | DG | A+ | NEG |
| E1299 | FANER STEEL SA | ES | 2026-02-06 | FC | DG | BBB | POS |
| E1300 | Livar Chemicals plc | GB | 2026-05-06 | FC | DG | BBB | NEG |
| E1300 | Livar Chemicals plc | GB | 2026-04-09 | FC | DG | BBB+ | STA |
| E1307 | Vevom Retail SA | VD | 2026-02-08 | FC | DG | BB- | POS |
| E1340 | Biram Steel plc | GB | 2026-06-26 | FC | DG | BBB+ | NEG |
| E1341 | Panar Airlines SA | FR | 2026-11-09 | FC | DG | BBB+ | NEG |
| E1342 | Cuvol Water AG | DE | 2026-07-17 | FC | DG | BBB+ | NEG |
| E1343 | Bolem Energy plc | GB | 2026-08-08 | FC | DG | BBB+ | NEG |
| E1344 | Naled Utilities plc | GB | 2026-03-18 | FC | DG | A- | NEG |
| E1345 | Wesen Retail plc | GB | 2026-09-22 | FC | DG | BB- | NEG |
| E1346 | Kalem Property AG | DE | 2026-10-15 | FC | DG | BBB+ | NEG |
| E1347 | Nunan Capital plc | GB | 2026-03-10 | FC | DG | BBB- | NEG |
| E1348 | Wosed Holdings AG | DE | 2026-03-18 | FC | DG | BBB- | NEG |
| E1349 | Parod Pharma SA | FR | 2026-10-14 | FC | DG | A- | NEG |
| E1350 | Palol Airlines plc | GB | 2026-09-03 | FC | DG | BB | NEG |
| E1351 | Bisad Property plc | GB | 2026-09-27 | FC | DG | A- | NEG |
| E16 | Brindle Capital Ltd | GB | 2026-06-01 | FC | DG | BB+ | STA |

Query 5:

| rated_id | date | rating | action | comment |
|---|---|---|---|---|
| E08 | 2026-07-08 | RD | DG | distressed debt exchange completed |

Query 6:

| entity_id | name | lei | country | entity_type | parent_id | source_system |
|---|---|---|---|---|---|---|
| E16 | Brindle Capital Ltd | 5493003Z3PXXR7KNFM81 | GB | CORP |  | QA |
| E17 | HALDEN BANK | 391200QYPVFF2O9K2039 | LU | BANK |  | RESEARCH |

Query 7:

| 1 |
|---|
| 1 |

Run more queries, or give the final answers.
The model
<invoke>
<parameter name="sql">select count(*) n, count(lei) nn, count(distinct nullif(lei,'')) dl, count(*) filter (where lei='') emp from entities;</parameter>
</invoke>
```sql
select count(*) n, count(lei) nn, count(distinct nullif(lei,'')) dl, count(*) filter (where lei='') emp from entities;
```

```sql
create or replace temp view cur as select * from (select *, row_number() over (partition by rated_id, rating_type, coalesce(ccy_basis,'') order by date desc, action_id desc) rn from rating_actions where date<='2026-10-01') where rn=1;
select count(distinct c.rated_id) ids, count(distinct coalesce(nullif(e.lei,''),e.entity_id)) leis, count(distinct case when e.country='GB' then e.entity_id end) gb_ids, count(distinct case when e.country='GB' then coalesce(nullif(e.lei,''),e.entity_id) end) gb_leis from cur c join entities e on e.entity_id=c.rated_id where c.rating_type='LTIDR' and c.action<>'WD';
```

```sql
select rated_id, ccy_basis, rating, outlook, watch, date from cur where rating_type='LTIDR' and action<>'WD' and (watch='RWN' or outlook='NEG') order by rated_id;
```

```sql
select rated_id, e.name, a.date, a.rating, a.action from rating_actions a join entities e on e.entity_id=a.rated_id where rating_type='LTIDR' and action='WD' and rated_id in (select rated_id from rating_actions where rating_type='LTIDR' group by 1 having max(date)<='2026-10-01') and date=(select max(date) from rating_actions b where b.rated_id=a.rated_id and b.rating_type='LTIDR') and rated_id in (select rated_id from rating_actions where rating_type='LTIDR' and action='WD' and date<='2026-10-01') order by date;
```

```sql
select e.entity_id,e.name,e.country,c.rating,c.date,k.rating ceiling from cur c join entities e on e.entity_id=c.rated_id join cur k on k.rated_id=e.country and k.rating_type='CC' where c.rating_type='LTIDR' and c.ccy_basis='FC' and c.action<>'WD' and e.entity_type<>'SOV' order by 1;
```

```sql
select count(*) from entities where country='LU';
with recursive g as (select entity_id from entities where entity_id in ('E09','E02') union all select e.entity_id from entities e join g on e.parent_id=g.entity_id) select * from g;
```

```sql
select c.rated_id, c.rating, i.issuer_id from cur c join instruments i on i.instrument_id=c.rated_id where c.rating_type='INST' and c.action not in ('EX','WD');
```


<invoke>
<parameter name="sql">select 1</parameter>
</invoke>
Query results
Query 1:

| n | nn | dl | emp |
|---|---|---|---|
| 370 | 368 | 342 | 0 |

Query 2:

| ids | leis | gb_ids | gb_leis |
|---|---|---|---|
| 293 | 291 | 75 | 74 |

Query 3:

| rated_id | ccy_basis | rating | outlook | watch | date |
|---|---|---|---|---|---|
| E01 | FC | BBB | NEG |  | 2026-02-10 |
| E06 | FC | A- |  | RWN | 2026-09-03 |
| E09 | FC | A | NEG |  | 2026-03-01 |
| E1005 | FC | BB | NEG |  | 2025-08-02 |
| E1006 | FC | AA |  | RWN | 2026-06-17 |
| E1013 | FC | BB- |  | RWN | 2025-07-09 |
| E1019 | LC | BBB- |  | RWN | 2024-03-20 |
| E1029 | FC | A- | NEG |  | 2025-08-08 |
| E1034 | FC | BBB+ | NEG |  | 2026-05-02 |
| E1037 | FC | A |  | RWN | 2022-05-07 |
| E1039 | FC | A |  | RWN | 2025-12-09 |
| E1046 | FC | AA- | NEG |  | 2025-05-28 |
| E1055 | FC | BBB- | NEG |  | 2024-12-04 |
| E1056 | FC | A+ | NEG |  | 2023-01-01 |
| E1059 | LC | BB- |  | RWN | 2026-02-23 |
| E1060 | FC | BB- | NEG |  | 2025-02-16 |
| E1061 | FC | A |  | RWN | 2025-06-06 |
| E1064 | FC | A- | NEG |  | 2026-06-03 |
| E1066 | FC | A- |  | RWN | 2026-05-03 |
| E1072 | FC | BB- | NEG |  | 2026-02-07 |
| E1079 | FC | BB+ | NEG |  | 2024-01-26 |
| E1080 | FC | A- | NEG |  | 2026-02-14 |
| E1088 | FC | B+ |  | RWN | 2024-01-16 |
| E1098 | FC | BBB- |  | RWN | 2026-04-28 |
| E1099 | FC | BB+ |  | RWN | 2023-11-05 |
| E1105 | FC | A+ | NEG |  | 2024-01-13 |
| E1109 | FC | A+ |  | RWN | 2025-12-25 |
| E1118 | FC | BB+ | NEG |  | 2025-07-14 |
| E1126 | FC | BB |  | RWN | 2025-07-10 |
| E1132 | FC | B+ |  | RWN | 2025-08-24 |
| E1133 | FC | B+ |  | RWN | 2025-10-11 |
| E1146 | FC | BB |  | RWN | 2025-08-12 |
| E1158 | FC | BBB | NEG |  | 2026-08-14 |
| E1161 | FC | B | NEG |  | 2026-07-28 |
| E1168 | FC | BBB- |  | RWN | 2023-10-12 |
| E1181 | FC | A- |  | RWN | 2025-01-06 |
| E1188 | FC | BB- | NEG |  | 2024-09-05 |
| E1190 | FC | BBB | NEG |  | 2025-05-24 |
| E1194 | FC | A |  | RWN | 2025-01-20 |
| E1203 | FC | BBB+ |  | RWN | 2023-09-02 |
| E1210 | FC | BB |  | RWN | 2024-09-09 |
| E1211 | FC | BBB- | NEG |  | 2024-09-26 |
| E1228 | FC | BB+ | NEG |  | 2026-06-28 |
| E1238 | FC | AA- |  | RWN | 2026-07-27 |
| E1242 | FC | BBB |  | RWN | 2025-09-11 |
| E1248 | FC | A- | NEG |  | 2026-05-02 |
| E1260 | FC | BBB- |  | RWN | 2025-09-05 |
| E1262 | FC | B+ | NEG |  | 2024-10-13 |
| E1263 | FC | BBB- | NEG |  | 2026-06-16 |
| E1264 | FC | B+ |  | RWN | 2024-05-18 |
| E1266 | FC | BBB |  | RWN | 2026-07-20 |
| E1267 | FC | A- |  | RWN | 2023-12-15 |
| E1271 | FC | A- | NEG |  | 2025-10-15 |
| E1282 | FC | BB+ | NEG |  | 2024-03-20 |
| E1294 | FC | A+ | NEG |  | 2026-07-11 |
| E1297 | FC | BBB |  | RWN | 2026-09-01 |
| E1300 | FC | BBB | NEG |  | 2026-05-06 |
| E1314 | FC | BBB |  | RWN | 2024-06-26 |
| E1317 | FC | BB |  | RWN | 2024-09-11 |
| E1323 | FC | AA- |  | RWN | 2025-01-06 |
(9 more rows not shown)

Query 4:

| rated_id | name | date | rating | action |
|---|---|---|---|---|
| E1048 | Lised Pharma AG | 2023-04-15 | WD | WD |
| E1166 | Ranim Shipping Inc | 2023-07-26 | WD | WD |
| E1320 | Cetem Industries SpA | 2023-10-15 | WD | WD |
| E1200 | Ganid Holdings plc | 2023-11-03 | WD | WD |
| E1041 | Hiral Steel SA | 2024-04-09 | WD | WD |
| E1244 | Palad Mining Inc | 2024-04-18 | WD | WD |
| E1076 | Rulid Capital SA | 2024-04-28 | WD | WD |
| E1124 | Dolom Steel plc | 2024-06-15 | WD | WD |
| E1316 | Rinal Foods BV | 2024-07-07 | WD | WD |
| E1107 | Warod Capital SA | 2024-10-16 | WD | WD |
| E1121 | Matal Foods AG | 2024-10-23 | WD | WD |
| E1279 | Denim Water SA | 2024-11-17 | WD | WD |
| E1138 | Konel Energy BV | 2024-12-26 | WD | WD |
| E1063 | Kotom Media SA | 2025-01-12 | WD | WD |
| E1233 | Kavid Industries AG | 2025-01-24 | WD | WD |
| E1062 | Puver Shipping plc | 2025-03-28 | WD | WD |
| E1225 | Kolom Utilities SA | 2025-06-12 | WD | WD |
| E1308 | Bavom Logistics AG | 2025-06-19 | WD | WD |
| E1002 | TUNOD STEEL SA | 2025-07-20 | WD | WD |
| E1084 | Poval Chemicals SA | 2025-08-02 | WD | WD |
| E1106 | Reril Pharma SA | 2025-08-10 | WD | WD |
| E1254 | VUSIR TELECOM SA | 2025-08-13 | WD | WD |
| E1140 | Danem Industries Inc | 2025-09-15 | WD | WD |
| E1021 | Niner Pharma plc | 2025-11-08 | WD | WD |
| E1205 | Misam Shipping SA | 2025-11-16 | WD | WD |
| E1206 | Rival Chemicals Inc | 2025-11-20 | WD | WD |
| E1277 | Lesol Steel SA | 2025-12-14 | WD | WD |
| E1172 | Vitid Property SA | 2026-03-12 | WD | WD |
| E1155 | Wavad Foods Inc | 2026-03-22 | WD | WD |
| E1219 | Sanen Property BV | 2026-04-11 | WD | WD |
| E07 | Pellam Retail Ltd | 2026-05-12 | WD | WD |
| E1218 | Putan Chemicals SA | 2026-05-22 | WD | WD |
| E1007 | Golod Property plc | 2026-06-27 | WD | WD |
| E1032 | Helom Chemicals BV | 2026-09-15 | WD | WD |
| E1057 | Batan Foods plc | 2026-09-19 | WD | WD |
| E1159 | Benem Property AG | 2026-09-22 | WD | WD |
| E1234 | Belor Telecom SpA | 2026-09-22 | WD | WD |

Query 5:

| entity_id | name | country | rating | date | ceiling |
|---|---|---|---|---|---|
| E05 | Valdoria Telecom SA | VD | BB | 2025-04-01 | BB |
| E1019 | Losol Mining SA | CV | BB+ | 2022-12-11 | A |
| E1028 | Mutir Retail SA | VD | BB | 2025-12-25 | BB |
| E1039 | Pulor Airlines SA | CV | A | 2025-12-09 | A |
| E1060 | KELIM MEDIA SA | CV | BB- | 2025-02-16 | A |
| E1071 | Mored Utilities SA | CV | B+ | 2023-01-11 | A |
| E1096 | Ravon Capital SA | CV | BBB | 2024-04-04 | A |
| E1101 | Doror Telecom SA | VD | BB | 2022-10-26 | BB |
| E1106 | Reril Pharma SA | VD | B+ | 2024-10-26 | BB |
| E1126 | Goter Capital SA | VD | BB | 2025-07-10 | BB |
| E1136 | Lenom Shipping SA | CV | A- | 2023-07-04 | A |
| E1144 | Witan Logistics SA | CV | B+ | 2026-06-06 | A |
| E1185 | Tosal Property SA | CV | BB+ | 2025-02-28 | A |
| E1194 | Litem Industries SA | CV | A | 2025-01-20 | A |
| E1217 | Worol Logistics SA | CV | BB- | 2025-09-07 | A |
| E1223 | Hilim Shipping SA | CV | BB+ | 2023-08-20 | A |
| E1229 | Fetam Mining SA | CV | BB+ | 2026-06-02 | A |
| E1236 | Nitel Retail SA | VD | BB | 2023-09-17 | BB |
| E1243 | Herar Foods SA | CV | BB | 2026-08-19 | A |
| E1245 | Gater Holdings SA | CV | B+ | 2025-09-11 | A |
| E1283 | Norad Airlines SA | CV | BB | 2024-11-03 | A |
| E1304 | Peson Shipping SA | CV | BB | 2026-07-25 | A |
| E1307 | Vevom Retail SA | VD | BB- | 2026-09-25 | BB |
| E1313 | Divim Holdings SA | VD | BB- | 2025-09-02 | BB |
| E15 | Corvenia Power SA | CV | A | 2024-03-01 | A |

Query 6:

| entity_id |
|---|
| E02 |
| E09 |
| E04 |
| E10 |
| E11 |

Query 7:

| rated_id | rating | issuer_id |
|---|---|---|
| I01 | BBB | E01 |
| I02 | BB+ | E01 |
| I03 | A | E04 |
| I04 | BB | E05 |
| I05 | BBB+ | E11 |
| I06 | A- | E15 |
| I07 | BBB- | E05 |
| I1002 | BB- | E1007 |
| I1003 | BBB- | E1008 |
| I1004 | A | E1009 |
| I1005 | BB | E1012 |
| I1006 | B+ | E1013 |
| I1009 | A- | E1018 |
| I1010 | A- | E1020 |
| I1011 | BBB- | E1021 |
| I1013 | BB+ | E1031 |
| I1014 | A- | E1035 |
| I1016 | A+ | E1041 |
| I1017 | BB | E1048 |
| I1018 | BB+ | E1049 |
| I1019 | BB+ | E1050 |
| I1020 | BB+ | E1052 |
| I1022 | BB+ | E1067 |
| I1023 | B | E1071 |
| I1024 | BB | E1077 |
| I1025 | BB+ | E1078 |
| I1026 | BB+ | E1079 |
| I1027 | BBB | E1082 |
| I1028 | A- | E1085 |
| I1029 | A+ | E1086 |
| I1030 | BBB- | E1087 |
| I1031 | B | E1088 |
| I1032 | BB- | E1090 |
| I1033 | B | E1103 |
| I1034 | A- | E1108 |
| I1035 | BB | E1114 |
| I1036 | A+ | E1115 |
| I1037 | BBB- | E1118 |
| I1038 | BBB+ | E1131 |
| I1039 | AA- | E1141 |
| I1040 | A+ | E1143 |
| I1041 | BB | E1145 |
| I1042 | A+ | E1147 |
| I1043 | A+ | E1149 |
| I1044 | BB- | E1155 |
| I1045 | A | E1156 |
| I1047 | A+ | E1162 |
| I1048 | BB+ | E1163 |
| I1050 | BBB- | E1168 |
| I1051 | B+ | E1188 |
| I1052 | BBB | E1189 |
| I1053 | BBB- | E1190 |
| I1054 | A+ | E1195 |
| I1055 | A | E1198 |
| I1056 | A- | E1205 |
| I1057 | AA- | E1206 |
| I1058 | A- | E1207 |
| I1059 | BB+ | E1208 |
| I1060 | A | E1213 |
| I1061 | A+ | E1218 |
(46 more rows not shown)

Query 8:

| 1 |
|---|
| 1 |

Run more queries, or give the final answers.
The model
<invoke>
<parameter name="sql">select 'lu' k, string_agg(entity_id, ',') v from entities where country='LU'
union all select 'rwn', string_agg(distinct rated_id, ',') from cur where rating_type='LTIDR' and watch='RWN'
union all select 'neg', string_agg(distinct rated_id, ',') from cur where rating_type='LTIDR' and outlook='NEG' and action<>'WD'
union all select 'inst', count(*)||' ig='||count(*) filter (where rating in ('AAA','AA+','AA','AA-','A+','A','A-','BBB+','BBB','BBB-')) from cur where rating_type='INST' and action not in ('EX','WD');</parameter>
</invoke>
```sql
select 'lu' k, string_agg(entity_id, ',') v from entities where country='LU'
union all select 'rwn', string_agg(distinct rated_id, ',') from cur where rating_type='LTIDR' and watch='RWN'
union all select 'neg', string_agg(distinct rated_id, ',') from cur where rating_type='LTIDR' and outlook='NEG' and action<>'WD'
union all select 'inst', count(*)||' ig='||count(*) filter (where rating in ('AAA','AA+','AA','AA-','A+','A','A-','BBB+','BBB','BBB-')) from cur where rating_type='INST' and action not in ('EX','WD');
```
Query results
Query 1:

| k | v |
|---|---|
| lu | E17 |
| rwn | E1133,E06,E1317,E1242,E1037,E1132,E1099,E1260,E1194,E1088,E1181,E1210,E1126,E1098,E1264,E1019,E1006,E1059,E1266,E1039,E1323,E1066,E1314,E1203,E1146,E1109,E1168,E1267,E1061,E1013,E1238,E1297 |
| neg | E1347,E1271,E1079,E1350,E1294,E1055,E1105,E1344,E1158,E1228,E1345,E1263,E1080,E1005,E1300,E1188,E1034,E1248,E1056,E1282,E1340,E1262,E09,E1211,E1060,E1072,E1190,E1029,E1161,E1342,E1351,E1064,E01,E1118,E1343,E1348,E1046 |
| inst | 106 ig=66 |

Run more queries, or give the final answers.
The model
```sql
create or replace temp view canon as select entity_id, first_value(entity_id) over (partition by coalesce(lei,entity_id) order by (source_system<>'RATINGS'), entity_id) c from entities;
```

```sql
select 'q7' k, string_agg(distinct c.c, ',' order by c.c) v from rating_actions a join canon c on c.entity_id=a.rated_id where a.rating_type='LTIDR' and a.action='DG' and a.date between '2026-01-01' and '2026-11-06'
union all select 'q18', string_agg(distinct c.c, ',' order by c.c) from cur a join canon c on c.entity_id=a.rated_id where a.rating_type='LTIDR' and a.watch='RWN' and a.action<>'WD'
union all select 'q19', string_agg(distinct c.c, ',' order by c.c) from cur a join canon c on c.entity_id=a.rated_id where a.rating_type='LTIDR' and a.outlook='NEG' and a.action<>'WD'
union all select 'q21', string_agg(c, ',' order by c) from (select c.c from rating_actions a join canon c on c.entity_id=a.rated_id where a.rating_type='LTIDR' and a.action<>'WD' and a.date<='2026-10-01' group by c.c having c.c not in (select c2.c from cur x join canon c2 on c2.entity_id=x.rated_id where x.rating_type='LTIDR' and x.action<>'WD'));
```
Query results
Query 1:

(no rows)

Query 2:

| k | v |
|---|---|
| q7 | E08,E10,E1034,E1051,E1053,E1057,E1058,E1064,E1080,E1093,E1112,E1144,E1151,E1159,E1160,E1163,E1167,E1169,E1186,E1213,E1228,E1229,E1243,E1255,E1263,E1285,E1290,E1294,E1298,E1300,E1307,E1340,E1342,E1343,E1344,E1345,E1346,E1347,E1348,E1349,E1350,E1351,E16 |
| q18 | E06,E1006,E1013,E1019,E1037,E1039,E1059,E1061,E1066,E1088,E1098,E1099,E1109,E1126,E1132,E1133,E1146,E1168,E1181,E1194,E1203,E1209,E1238,E1242,E1260,E1264,E1266,E1267,E1297,E1314,E1317,E1323 |
| q19 | E01,E09,E1005,E1029,E1034,E1046,E1055,E1056,E1059,E1064,E1072,E1079,E1080,E1105,E1118,E1158,E1160,E1188,E1190,E1211,E1228,E1248,E1261,E1263,E1271,E1282,E1294,E1300,E1340,E1342,E1343,E1344,E1345,E1347,E1348,E1350,E1351 |
| q21 | E07,E1001,E1007,E1021,E1032,E1041,E1048,E1057,E1062,E1063,E1076,E1084,E1107,E1121,E1124,E1138,E1140,E1155,E1159,E1166,E1172,E1200,E1205,E1206,E1218,E1219,E1225,E1233,E1234,E1244,E1253,E1277,E1308,E1316,E1320 |

Run more queries, or give the final answers.
The model
**Q1.** A-. Kestrel's LTIDR was A- from 2024-03-12 (A01) until the downgrade to BBB on 2025-06-20 (A02).

**Q2.** No. The only 2026 action on Kestrel is A03, an affirmation at BBB with the outlook moved to Negative.

**Q3.** No, BB+. I02 (the 2031 subordinated note) was cut from BBB to BB+ in A07.

**Q4.** Positive. E02 and E03 share one LEI, so they are the same entity, and the latest action is A09 (2025-09-15), an affirmation at A with a Positive outlook.

**Q5.** Northwind Holdings (E02), rated A. I03 is issued by E04 but guaranteed by E02, and E02's rating is A (A09 on E03, the duplicate record).

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

**Q7.** 43 issuers were downgraded in 2026 (IDs in the JSON, including E08, E10 and E16). Each has an LTIDR "DG" action dated 2026-01-01 to 2026-11-06.

**Q8.** E08 (Saxby Shipping). It was downgraded to RD on 2026-07-08 (A22), and there are no later actions.

**Q9.** 291. These are the distinct entities, deduplicated by LEI, whose latest LTIDR action on or before 2026-10-01 was not a withdrawal. The count includes the two sovereigns.

**Q10.** Depends. The foreign-currency rating is BB (sub-investment grade) and the local-currency rating is BBB- (investment grade).

**Q11.** BBB+. E14 was downgraded from A- to BBB+ on 2024-09-30 (A36), and the next action is 2025-11-20.

**Q12.** A-. E14 was assigned A- on 2023-01-15 (A34).

**Q13.** 1. The only downgrade is A36.

**Q14.** None. Halden Foods (E12) was first rated on 2024-02-01 (A30).

**Q15.** A-. E10 was assigned A- (A26), and the downgrade to BBB+ (A27) came on 2026-04-15.

**Q16.** No. It was BBB+ on 2025-01-01 and is still BBB+, with an A35 watch and an A33 affirmation in between.

**Q17.** No. Orrin Bank (E06) has only A16 and A17, and A17 is a Rating Watch Negative placement at A-, not a downgrade.

**Q18.** 32 issuers were on Rating Watch Negative on 1 October 2026 (IDs in the JSON). Each has a latest LTIDR action that is a watch.

**Q19.** 37 issuers had a Negative outlook on 1 October 2026 (IDs in the JSON), including E01 (A03) and E09 (A25).

**Q20.** No. Pellam (E07) was withdrawn for commercial reasons (A19), and its last rating was BB; no default rating was ever recorded.

**Q21.** 35 entities (IDs in the JSON). Each had an LTIDR before 2026-10-01 but its latest LTIDR action is a withdrawal, as with E07.

**Q22.** E08, the only entity with an RD rating (A22).

**Q23.** F2 (A04).

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

**Q25.** 66. Of 106 instruments rated on 1 October 2026, 66 were BBB- or higher.

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

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

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

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

**Q30.** E05, E1028, E1039, E1101, E1126, E1194, E1236 and E15. Each has a foreign-currency LTIDR equal to its country's ceiling.

**Q31.** No. No foreign-currency rating exceeds its country's ceiling.

**Q32.** E09. E11's parent is E10, whose parent is E09.

**Q33.** Halden Bank (E10), rated BBB+. I05 is issued by E11 but guaranteed by E10, and both the note (A29) and E10 (A27) are BBB+.

**Q34.** No. E12 (Halden Foods) has no parent link, so it is not in E09's group; the shared name is not evidence.

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

**Q36.** 2: E02 and E04. E03 is a duplicate record of E02.

**Q37.** 344. The 370 records contain 342 distinct LEIs, and the two sovereigns (CV, VD) have no LEI.

**Q38.** No. E06 and E13 have different LEIs and are a bank and a holding company, so they are separate entities.

**Q39.** A. E02 and E03 are the same entity, and the latest action (A09) is an affirmation at A.

**Q40.** 74. These are distinct GB-domiciled entities, deduplicated by LEI, with an active issuer rating on 1 October 2026.

**Q41.** BB+. E16 was downgraded on 2026-06-01. It comes from the QA source system.

**Q42.** DE. E10 is the RATINGS record; E17, the LU record, is a RESEARCH duplicate with the same LEI.

**Q43.** 0. The only LU record, E17, is a duplicate of the German E10, so I treated it as not a separate LU entity. If you count raw records instead, the answer is 1.

**Q44.** Yes. I07 is denominated in XVD, which I read as Valdoria's local currency.

**Q45.** No. The ceiling (BB) limits foreign-currency ratings, and I07 is a local-currency note rated BBB- (A45).

**Q46.** No. E11 has only a CO-type rating (A46, BBB), not an LTIDR.

**Q47.** None. I08's rating was expired by an EX action on 2026-09-01 (A47).

**Q48.** 106. This counts instruments whose latest INST action on or before 2026-10-01 is not an expiry or withdrawal.

```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","E1034","E1051","E1053","E1057","E1058","E1064","E1080","E1093","E1112","E1144","E1151","E1159","E1160","E1163","E1167","E1169","E1186","E1213","E1228","E1229","E1243","E1255","E1263","E1285","E1290","E1294","E1298","E1300","E1307","E1340","E1342","E1343","E1344","E1345","E1346","E1347","E1348","E1349","E1350","E1351","E16"]},
"Q8": {"entities": ["E08"]},
"Q9": {"count": 291},
"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","E1006","E1013","E1019","E1037","E1039","E1059","E1061","E1066","E1088","E1098","E1099","E1109","E1126","E1132","E1133","E1146","E1168","E1181","E1194","E1203","E1209","E1238","E1242","E1260","E1264","E1266","E1267","E1297","E1314","E1317","E1323"]},
"Q19": {"issuers": ["E01","E09","E1005","E1029","E1034","E1046","E1055","E1056","E1059","E1064","E1072","E1079","E1080","E1105","E1118","E1158","E1160","E1188","E1190","E1211","E1228","E1248","E1261","E1263","E1271","E1282","E1294","E1300","E1340","E1342","E1343","E1344","E1345","E1347","E1348","E1350","E1351"]},
"Q20": {"in_default": "no"},
"Q21": {"entities": ["E07","E1001","E1007","E1021","E1032","E1041","E1048","E1057","E1062","E1063","E1076","E1084","E1107","E1121","E1124","E1138","E1140","E1155","E1159","E1166","E1172","E1200","E1205","E1206","E1218","E1219","E1225","E1233","E1234","E1244","E1253","E1277","E1308","E1316","E1320"]},
"Q22": {"entities": ["E08"]},
"Q23": {"rating": "F2"},
"Q24": {"investment_grade": "yes"},
"Q25": {"count": 66},
"Q26": {"rating": "A+"},
"Q27": {"rating": "A-"},
"Q28": {"rating": "BBB+"},
"Q29": {"rating": "none"},
"Q30": {"entities": ["E05","E1028","E1039","E1101","E1126","E1194","E1236","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": 344},
"Q38": {"same": "no"},
"Q39": {"rating": "A"},
"Q40": {"count": 74},
"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": 106}
}
```