D2 sql+markdown, run 1: the query session
18 queries1 failed5 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
### ontology.md (the vocabulary the data uses)
# Credit ratings: a teaching ontology
Entities, instruments, rating actions and the codes the data uses, each with a definition that states what it means and how to read it. Invented for an experiment; not a model of any real rating agency.
## Classes
### Entity
A legal entity: a company, bank, finance subsidiary or sovereign. An entity is identified by its LEI (LEI), not by its name or record ID. The data holds records from more than one source system (source system), so the same entity can appear as several records with different IDs and differently spelled names: two records with the same LEI are the same entity, and every fact recorded against either record is a fact about that one entity.
### Instrument
A debt instrument, such as a bond or note, issued by an entity (issuer). An instrument's rating is not the issuer's rating: it can sit above or below it depending on seniority (seniority) and on any guarantee (guarantor).
### Rating action
Something a rating agency did to a rating on a date (date): assigned, affirmed, upgraded, downgraded, placed on Watch or withdrawn it. Each action applies to one rated thing (rated thing), one rating type (rating type) and, for issuer ratings, one currency basis (currency basis). A rating holds from its action date until the next action on the same thing, type and basis: so the rating on a date D is the one set by the latest action on or before D, and the current rating is the latest action overall. rating always holds the rating as it stands after the action, including when it did not change.
## Properties
### name (CSV column `name`)
The name as the source system spells it. Names are not identifiers: the same entity can be spelled differently in different systems.
### LEI (CSV column `lei`)
Legal Entity Identifier: the identifier that says which legal entity a record describes. Same LEI, same entity. Sovereigns have none.
### country (CSV column `country`)
ISO-style code of the country where the entity is domiciled. Where an entity's records disagree, see source system for which holds. It decides which Country Ceiling, if any, applies to the entity's foreign-currency ratings. VD is the Republic of Valdoria and CV the Republic of Corvenia (both invented).
### entity type (CSV column `entity_type`)
What kind of entity it is: a concept of the scheme Entity types.
### parent (CSV column `parent_id`)
The entity that owns and controls this one. A parent link names a record, but points at the entity that record describes, so the chain continues from any of that entity's records. Following parents up to an entity with no parent gives the ultimate parent; a group is an ultimate parent and every entity whose chain of parents ends at it.
### source system (CSV column `source_system`)
The internal system the record comes from (RATINGS, RESEARCH, QA). Each system keeps its own records of the same entities; see Entity. Where records of the same entity disagree, which one holds depends on the field. RATINGS is the system of record for names and parent links. Domicile is the exception: the RESEARCH team checks each entity's registered office against its filings, so where records disagree on country, the RESEARCH record holds. QA records are test data, created to check the systems: they describe no real entity, so a QA record, and every action recorded against it, must be ignored.
### description (CSV column `description`)
The instrument's name: issuer, coupon and maturity year.
### issuer (CSV column `issuer_id`)
The entity that issued the instrument and owes the payments. Not necessarily the entity whose credit risk the investor takes: see guarantor.
### guarantor (CSV column `guarantor_id`)
An entity that guarantees the instrument's payments if the issuer does not pay. A guaranteed instrument carries the guarantor's credit risk, so it is rated in line with the guarantor's issuer rating, not the issuer's.
### seniority (CSV column `seniority`)
Where the instrument ranks in repayment if the issuer fails: a concept of the scheme Seniorities.
### currency (CSV column `currency`)
The currency the instrument pays in, as an ISO 4217 code, or one of two local codes: XVD, the Valdorian dollar, the domestic currency of VD; and CVK, the Corvenian krone, the domestic currency of CV. Debt in a currency other than the domestic one of the issuer's country is exposed to that country's transfer and convertibility risk: see Country Ceiling (CC). Debt in the domestic currency is local-currency debt and is not capped by the ceiling.
### maturity (CSV column `maturity`)
The date the instrument is due to be repaid.
### date (CSV column `date`)
The date the action took effect.
### rated thing (CSV column `rated_id`)
What the action is about: an entity (for issuer ratings and Country Ceilings) or an instrument (for instrument ratings).
### rating type (CSV column `rating_type`)
Which kind of rating the action concerns: a concept of the scheme Rating types. Different types are different ratings and are never compared or combined with each other.
### currency basis (CSV column `ccy_basis`)
For issuer ratings, whether the rating covers foreign-currency (FC) or local-currency (LC) obligations: a concept of the scheme Currency bases. An entity can have both, with different values.
### action (CSV column `action`)
What was done: a concept of the scheme Action types. Only upgrades and downgrades change a rating.
### rating (CSV column `rating`)
The rating after the action, on the scale of its rating type. Long-term scale, strongest to weakest: AAA, AA+, AA, AA-, A+, A, A-, BBB+, BBB, BBB-, BB+, BB, BB-, B+, B, B-, CCC, CC, C, RD, D. Investment grade means BBB- or higher; BB+ and below is speculative grade (high yield). RD (restricted default) means the issuer has defaulted on some material obligations, for instance by completing a distressed debt exchange, without being wound up: RD is a default. D means a general default. Short-term scale, strongest to weakest: F1+, F1, F2, F3, B, C, RD, D. WD means the rating was withdrawn (see Withdrawn (WD)): it is not a point on either scale.
### outlook (CSV column `outlook`)
The likely direction of a long-term rating over the next one to two years: a concept of the scheme Outlooks. An outlook is not a rating: revising it does not change the rating.
### rating watch (CSV column `watch`)
Set when the rating is on Rating Watch: a concept of the scheme Rating Watches. A Watch is not a rating change.
### comment (CSV column `comment`)
The analyst's note on the action, such as the reason for a withdrawal.
## Codes
The codes as they appear in the data, grouped by list.
### Rating types
- **LTIDR**, Long-term Issuer Default Rating: The issuer's own creditworthiness: how likely it is to default on its obligations, on the long-term scale. This is what people usually mean by an entity's rating. The foreign-currency (FC) one is the headline rating; there may also be a local-currency (LC) one.
- **STIDR**, Short-term Issuer Default Rating: The issuer's ability to meet obligations falling due within about a year, on the short-term scale (F1+ to D). Not comparable with long-term ratings.
- **INST**, Instrument rating: The rating of one specific instrument. It starts from the issuer's long-term rating and is notched for the instrument's seniority and expected recovery: subordinated debt is usually rated below the issuer, and guaranteed debt is rated on the guarantor. An instrument rating is never the rating of the issuer.
- **CC**, Country Ceiling: Not a rating of anyone. A cap, set for a country, on the foreign-currency ratings of entities domiciled there and of their foreign-currency debt. It reflects transfer and convertibility risk: the risk that the government stops money being converted or sent abroad, so even a sound company could not pay foreign-currency debt. Foreign-currency ratings of entities in the country are generally no higher than the ceiling; local-currency ratings are not capped. A Country Ceiling is not the sovereign's own issuer rating.
- **CO**, Credit opinion: A private, point-in-time view of an entity's credit, given to one client. It is not a published rating and not an issuer rating: never count it as a rating, and never report its value as the entity's rating.
### Currency bases
- **FC**, Foreign currency: Covers obligations in foreign currency, so it is subject to the Country Ceiling.
- **LC**, Local currency: Covers obligations in the currency of the entity's own country; not subject to the Country Ceiling.
### Action types
- **AS**, Assigned: A first rating is given.
- **AF**, Affirmed: The rating is reviewed and kept the same. The outlook may be revised in the same action; that does not make it an upgrade or a downgrade.
- **UG**, Upgraded: The rating is raised.
- **DG**, Downgraded: The rating is lowered. The only action that counts as a downgrade.
- **RW**, Placed on Rating Watch: The rating is flagged as likely to change soon, usually within about six months, in the direction rating watch gives. The rating itself is unchanged: not a downgrade.
- **WD**, Withdrawn: The agency stops maintaining the rating, often for commercial reasons (the issuer no longer pays for it, or the debt is repaid). After a withdrawal the entity has no rating of that type. A withdrawal is not a credit event: it says nothing about default, and is not a downgrade.
- **EX**, Expected rating: A rating signalled before an instrument's final documents are signed. It is not yet a rating: the instrument stays unrated until an Assigned (AS) action confirms it.
### Outlooks
- **STA**, Stable: No direction expected.
- **POS**, Positive: The rating may go up over one to two years.
- **NEG**, Negative: The rating may go down over one to two years. Not a downgrade.
### Rating Watches
- **RWN**, Rating Watch Negative: A downgrade is likely in the near term. Not a downgrade yet.
### Seniorities
- **SU**, Senior unsecured: Ranks with the issuer's ordinary debts; usually rated at the level of the issuer's long-term rating.
- **SUB**, Subordinated: Repaid only after senior debt, so investors recover less in a default; usually rated one or more notches below the issuer's long-term rating.
### Entity types
- **CORP**, Corporate: A non-financial company.
- **BANK**, Bank: A bank.
- **FINSUB**, Finance subsidiary: A subsidiary that exists to raise debt for its parent group. It usually has no issuer rating of its own; its debt is guaranteed by the parent, so investors take the parent's credit risk.
- **SOV**, Sovereign: A national government. A sovereign record can carry a Country Ceiling, issuer ratings, or both: they are different things, and the ceiling is not the sovereign's rating.
## 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 name="bash">
<parameter name="command">echo placeholder</parameter>
</invoke>
```sql
select * from entities order by entity_id;
```
```sql
select * from instruments order by instrument_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 |
| 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)
Run more queries, or give the final answers.The model
```sql
select * from entities where entity_id not like 'E1%' or name ilike any ('%Marlow%','%Halden%','%Orrin%','%Brindle%','%Corvenia%','%Pellam%','%Valdoria%','%Northwind%','%Kestrel%') order by entity_id;
```
```sql
select * from rating_actions where rated_id in ('CV','VD','E01','E02','E03','E04','E05','E06','E07','E08','E09','E10','E11','E12','E13','E14','E15','E16','E17','E18','I01','I02','I03','I04','I05','I06','I07','I08') order by rated_id, rating_type, ccy_basis, date;
```
```sql
select * from instruments where instrument_id like 'I0%' or issuer_id in ('E11','E15') order by instrument_id;
```Query results
Query 1 failed: Parser Error: syntax error at or near ","
Query 2:
| action_id | date | rated_id | rating_type | ccy_basis | action | rating | outlook | watch | comment |
|---|---|---|---|---|---|---|---|---|---|
| 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 | | |
| 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 | | |
| A14 | 2025-04-01 | E05 | LTIDR | FC | AS | BB | STA | | |
| A13 | 2025-04-01 | E05 | LTIDR | LC | AS | BBB- | 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 not like 'E1%' or regexp_matches(name,'(?i)marlow|halden|orrin|brindle|corvenia|pellam|valdoria|northwind|kestrel') order by entity_id;
```
```sql
select * from instruments where instrument_id not like 'I1%' or issuer_id in ('E11','E15') order by instrument_id;
```
```sql
select source_system, count(*), count(distinct lei) from entities group by 1;
```
```sql
select count(distinct coalesce(lei, entity_id)) from entities where source_system<>'QA';
```
```sql
select * from rating_actions where rated_id in (select entity_id from entities where source_system='QA') or rated_id like 'E0%' and false;
```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:
| source_system | count_star() | count(DISTINCT lei) |
|---|---|---|
| QA | 13 | 13 |
| RESEARCH | 26 | 26 |
| RATINGS | 331 | 329 |
Query 4:
| count(DISTINCT COALESCE(lei, entity_id)) |
|---|
| 331 |
Query 5:
| action_id | date | rated_id | rating_type | ccy_basis | action | rating | outlook | watch | comment |
|---|---|---|---|---|---|---|---|---|---|
| A43 | 2024-04-01 | E16 | LTIDR | FC | AS | BBB- | STA | | |
| A44 | 2026-06-01 | E16 | LTIDR | FC | DG | BB+ | STA | | |
| A1737 | 2025-12-21 | E1350 | LTIDR | FC | AS | BB+ | STA | | |
| A1740 | 2026-09-27 | E1351 | LTIDR | FC | DG | A- | NEG | | |
| A1738 | 2026-09-03 | E1350 | LTIDR | FC | DG | BB | NEG | | |
| A1730 | 2026-10-15 | E1346 | LTIDR | FC | DG | BBB+ | NEG | | |
| A1732 | 2026-03-10 | E1347 | LTIDR | FC | DG | BBB- | NEG | | |
| A1725 | 2023-09-25 | E1344 | LTIDR | FC | AS | A | STA | | |
| A1731 | 2025-03-16 | E1347 | LTIDR | FC | AS | BBB | STA | | |
| A1733 | 2023-11-28 | E1348 | LTIDR | FC | AS | BBB | STA | | |
| A1727 | 2024-11-02 | E1345 | LTIDR | FC | AS | BB | STA | | |
| A1719 | 2025-09-05 | E1341 | LTIDR | FC | AS | A- | STA | | |
| A1721 | 2024-08-06 | E1342 | LTIDR | FC | AS | A- | STA | | |
| A1739 | 2023-12-10 | E1351 | LTIDR | FC | AS | A | STA | | |
| A1736 | 2026-10-14 | E1349 | LTIDR | FC | DG | A- | NEG | | |
| A1723 | 2023-05-12 | E1343 | LTIDR | FC | AS | A- | STA | | |
| A1734 | 2026-03-18 | E1348 | LTIDR | FC | DG | BBB- | NEG | | |
| A1720 | 2026-11-09 | E1341 | LTIDR | FC | DG | BBB+ | NEG | | |
| A1726 | 2026-03-18 | E1344 | LTIDR | FC | DG | A- | NEG | | |
| A1717 | 2024-12-16 | E1340 | LTIDR | FC | AS | A- | STA | | |
| A1724 | 2026-08-08 | E1343 | LTIDR | FC | DG | BBB+ | NEG | | |
| A1718 | 2026-06-26 | E1340 | LTIDR | FC | DG | BBB+ | NEG | | |
| A1735 | 2025-02-17 | E1349 | LTIDR | FC | AS | A | STA | | |
| A1728 | 2026-09-22 | E1345 | LTIDR | FC | DG | BB- | NEG | | |
| A1729 | 2023-06-18 | E1346 | LTIDR | FC | AS | A- | STA | | |
| A1722 | 2026-07-17 | E1342 | LTIDR | FC | DG | BBB+ | NEG | | |
Run more queries, or give the final answers.The model
<invoke name="bash">
<parameter name="command">echo skip</parameter>
</invoke>
```sql
with ent as (select e.*, coalesce(lei,entity_id) k from entities e where source_system<>'QA'),
canon as (select k, min(case when source_system='RATINGS' then entity_id end) id from ent group by k)
select distinct c.id, a.action_id, a.date, a.rating_type, a.ccy_basis, a.rating from rating_actions a join ent e on e.entity_id=a.rated_id join canon c on c.k=e.k
where a.action='DG' and a.date between '2026-01-01' and '2026-12-31' and a.rating_type in ('LTIDR','STIDR') order by 1;
```
```sql
with ent as (select e.*, coalesce(lei,entity_id) k from entities e where source_system<>'QA'),
canon as (select k, min(case when source_system='RATINGS' then entity_id end) id from ent group by k),
st as (select c.id, a.*, row_number() over (partition by c.id, a.rating_type, a.ccy_basis order by a.date desc, a.action_id desc) rn
from rating_actions a join ent e on e.entity_id=a.rated_id join canon c on c.k=e.k where a.date<='2026-10-01' and a.rating_type='LTIDR')
select 'default' q, id, ccy_basis, rating, outlook, watch from st where rn=1 and rating in ('RD','D')
union all select 'rwn', id, ccy_basis, rating, outlook, watch from st where rn=1 and watch='RWN'
union all select 'neg', id, ccy_basis, rating, outlook, watch from st where rn=1 and outlook='NEG'
union all select 'wd', id, ccy_basis, rating, outlook, watch from st where rn=1 and rating='WD'
union all select 'rwOutlookBlank', id, ccy_basis, rating, outlook, watch from st where rn=1 and action='RW'
order by 1,2;
```
```sql
with ent as (select e.*, coalesce(lei,entity_id) k from entities e where source_system<>'QA'),
canon as (select k, min(case when source_system='RATINGS' then entity_id end) id, coalesce(max(case when source_system='RESEARCH' then country end), min(case when source_system='RATINGS' then country end)) ctry from ent group by k),
st as (select c.id, c.ctry, a.*, row_number() over (partition by c.id, a.rating_type, a.ccy_basis order by a.date desc, a.action_id desc) rn
from rating_actions a join ent e on e.entity_id=a.rated_id join canon c on c.k=e.k where a.date<='2026-10-01')
select 'issuers_rated' q, count(distinct id)::varchar v from st where rn=1 and rating_type='LTIDR' and rating<>'WD'
union all select 'gb', count(distinct id)::varchar from st where rn=1 and rating_type='LTIDR' and rating<>'WD' and ctry='GB'
union all select 'LU', count(*)::varchar from canon where ctry='LU'
union all select 'everdefault', string_agg(distinct id, ',') from st s2 where false
union all select 'ceil_eq', string_agg(f.id||':'||f.rating||'/'||cc.rating, ',') from st f join st cc on cc.rating_type='CC' and cc.rn=1 and cc.id in (select id from canon where id=f.ctry) where f.rn=1 and f.rating_type='LTIDR' and f.ccy_basis='FC' and f.rating=cc.rating
union all select 'ceilings', string_agg(id||':'||rating, ',') from st where rating_type='CC' and rn=1;
```
```sql
with ent as (select e.*, coalesce(lei,entity_id) k from entities e where source_system<>'QA'),
canon as (select k, min(case when source_system='RATINGS' then entity_id end) id, coalesce(max(case when source_system='RESEARCH' then country end), min(case when source_system='RATINGS' then country end)) ctry from ent group by k)
select c.id, count(*) from rating_actions a join ent e on e.entity_id=a.rated_id join canon c on c.k=e.k where a.rating in ('RD','D') and a.rating_type='LTIDR' group by 1 order by 1;
```
```sql
select ctry, count(*) from (select coalesce(lei,entity_id) k, coalesce(max(case when source_system='RESEARCH' then country end), min(case when source_system='RATINGS' then country end)) ctry from entities where source_system<>'QA' group by 1) group by 1 order by 2 desc;
```
```sql
with st as (select a.*, row_number() over (partition by rated_id order by date desc, action_id desc) rn from rating_actions a where rating_type='INST' and action<>'EX' and date<='2026-10-01')
select count(*) rated, sum(case when rating in ('AAA','AA+','AA','AA-','A+','A','A-','BBB+','BBB','BBB-') then 1 else 0 end) ig, sum(case when rating='WD' then 1 else 0 end) wd from st where rn=1;
```
```sql
select e.entity_id, e.name, e.parent_id, e.source_system, e.country from entities e where source_system<>'QA' and (parent_id is not null) order by parent_id, entity_id;
```Query results
Query 1:
| id | action_id | date | rating_type | ccy_basis | rating |
|---|---|---|---|---|---|
| E08 | A21 | 2026-01-20 | LTIDR | FC | CCC |
| E08 | A22 | 2026-07-08 | LTIDR | FC | RD |
| E10 | A27 | 2026-04-15 | LTIDR | FC | BBB+ |
| E1034 | A1070 | 2026-05-02 | LTIDR | FC | BBB+ |
| E1051 | A1102 | 2026-04-05 | LTIDR | FC | A+ |
| E1051 | A1104 | 2026-06-01 | LTIDR | FC | A+ |
| E1053 | A1109 | 2026-03-20 | LTIDR | FC | BB |
| E1057 | A1122 | 2026-06-25 | LTIDR | FC | BB |
| E1058 | A1127 | 2026-07-14 | LTIDR | FC | BBB- |
| E1064 | A1140 | 2026-03-04 | LTIDR | FC | BBB+ |
| E1080 | A1174 | 2026-02-14 | LTIDR | FC | A- |
| E1093 | A1202 | 2026-07-25 | LTIDR | FC | B |
| E1112 | A1244 | 2026-02-20 | LTIDR | FC | BBB |
| E1144 | A1310 | 2026-06-06 | LTIDR | FC | B+ |
| E1151 | A1326 | 2026-01-26 | LTIDR | FC | BBB |
| E1159 | A1341 | 2026-06-16 | LTIDR | FC | BBB+ |
| E1160 | A1344 | 2026-07-28 | LTIDR | FC | B |
| E1163 | A1350 | 2026-03-19 | LTIDR | FC | BB+ |
| E1167 | A1360 | 2026-09-07 | LTIDR | FC | BB |
| E1169 | A1366 | 2026-08-16 | LTIDR | FC | BB- |
| E1186 | A1395 | 2026-01-04 | LTIDR | FC | BBB+ |
| E1213 | A1451 | 2026-06-16 | LTIDR | FC | BBB+ |
| E1213 | A1450 | 2026-02-13 | LTIDR | FC | A- |
| E1228 | A1479 | 2026-06-28 | LTIDR | FC | BB+ |
| E1229 | A1482 | 2026-05-06 | LTIDR | FC | BB |
| E1229 | A1481 | 2026-06-02 | LTIDR | FC | BB+ |
| E1243 | A1516 | 2026-01-13 | LTIDR | FC | BB |
| E1255 | A1545 | 2026-01-19 | LTIDR | FC | BBB+ |
| E1263 | A1561 | 2026-03-03 | LTIDR | FC | BBB |
| E1263 | A1562 | 2026-06-16 | LTIDR | FC | BBB- |
| E1285 | A1608 | 2026-02-17 | LTIDR | FC | A |
| E1290 | A1620 | 2026-08-16 | LTIDR | FC | B |
| E1294 | A1627 | 2026-07-11 | LTIDR | FC | A+ |
| E1298 | A1636 | 2026-02-06 | LTIDR | FC | BBB |
| E1300 | A1640 | 2026-05-06 | LTIDR | FC | BBB |
| E1300 | A1639 | 2026-04-09 | LTIDR | FC | BBB+ |
| E1307 | A1660 | 2026-02-08 | LTIDR | FC | BB- |
Query 2:
| q | id | ccy_basis | rating | outlook | watch |
|---|---|---|---|---|---|
| default | E08 | FC | RD | | |
| neg | E01 | FC | BBB | NEG | |
| neg | E09 | FC | A | NEG | |
| neg | E1005 | FC | BB | NEG | |
| neg | E1029 | FC | A- | NEG | |
| neg | E1034 | FC | BBB+ | NEG | |
| neg | E1046 | FC | AA- | NEG | |
| neg | E1055 | FC | BBB- | NEG | |
| neg | E1056 | FC | A+ | NEG | |
| neg | E1059 | FC | BB- | NEG | |
| neg | E1064 | FC | A- | NEG | |
| neg | E1072 | FC | BB- | NEG | |
| neg | E1079 | FC | BB+ | NEG | |
| neg | E1080 | FC | A- | NEG | |
| neg | E1105 | FC | A+ | NEG | |
| neg | E1118 | FC | BB+ | NEG | |
| neg | E1158 | FC | BBB | NEG | |
| neg | E1160 | FC | B | NEG | |
| neg | E1188 | FC | BB- | NEG | |
| neg | E1190 | FC | BBB | NEG | |
| neg | E1211 | FC | BBB- | NEG | |
| neg | E1228 | FC | BB+ | NEG | |
| neg | E1248 | FC | A- | NEG | |
| neg | E1261 | FC | B+ | NEG | |
| neg | E1263 | FC | BBB- | NEG | |
| neg | E1271 | FC | A- | NEG | |
| neg | E1282 | FC | BB+ | NEG | |
| neg | E1294 | FC | A+ | NEG | |
| neg | E1300 | FC | BBB | NEG | |
| rwOutlookBlank | E06 | FC | A- | | RWN |
| rwOutlookBlank | E1006 | FC | AA | | RWN |
| rwOutlookBlank | E1013 | FC | BB- | | RWN |
| rwOutlookBlank | E1019 | LC | BBB- | | RWN |
| rwOutlookBlank | E1037 | FC | A | | RWN |
| rwOutlookBlank | E1039 | FC | A | | RWN |
| rwOutlookBlank | E1059 | LC | BB- | | RWN |
| rwOutlookBlank | E1061 | FC | A | | RWN |
| rwOutlookBlank | E1066 | FC | A- | | RWN |
| rwOutlookBlank | E1088 | FC | B+ | | RWN |
| rwOutlookBlank | E1098 | FC | BBB- | | RWN |
| rwOutlookBlank | E1099 | FC | BB+ | | RWN |
| rwOutlookBlank | E1109 | FC | A+ | | RWN |
| rwOutlookBlank | E1126 | FC | BB | | RWN |
| rwOutlookBlank | E1132 | FC | B+ | | RWN |
| rwOutlookBlank | E1133 | FC | B+ | | RWN |
| rwOutlookBlank | E1146 | FC | BB | | RWN |
| rwOutlookBlank | E1168 | FC | BBB- | | RWN |
| rwOutlookBlank | E1181 | FC | A- | | RWN |
| rwOutlookBlank | E1194 | FC | A | | RWN |
| rwOutlookBlank | E1203 | FC | BBB+ | | RWN |
| rwOutlookBlank | E1209 | FC | BB | | RWN |
| rwOutlookBlank | E1238 | FC | AA- | | RWN |
| rwOutlookBlank | E1242 | FC | BBB | | RWN |
| rwOutlookBlank | E1260 | FC | BBB- | | RWN |
| rwOutlookBlank | E1264 | FC | B+ | | RWN |
| rwOutlookBlank | E1266 | FC | BBB | | RWN |
| rwOutlookBlank | E1267 | FC | A- | | RWN |
| rwOutlookBlank | E1297 | FC | BBB | | RWN |
| rwOutlookBlank | E1314 | FC | BBB | | RWN |
| rwOutlookBlank | E1317 | FC | BB | | RWN |
(70 more rows not shown)
Query 3:
| q | v |
|---|---|
| issuers_rated | 278 |
| gb | 66 |
| LU | 1 |
| everdefault | |
| ceil_eq | E1194:A/A,E15:A/A,E1028:BB/BB,E1101:BB/BB,E1126:BB/BB,E1236:BB/BB,E05:BB/BB,E1039:A/A |
| ceilings | CV:A,VD:BB |
Query 4:
| id | count_star() |
|---|---|
| E08 | 1 |
Query 5:
| ctry | count_star() |
|---|---|
| GB | 78 |
| US | 52 |
| FR | 45 |
| DE | 38 |
| ES | 28 |
| NL | 27 |
| IT | 19 |
| CV | 17 |
| GR | 16 |
| VD | 10 |
| LU | 1 |
Query 6:
| rated | ig | wd |
|---|---|---|
| 106 | 66 | 0 |
Query 7:
| entity_id | name | parent_id | source_system | country |
|---|---|---|---|---|
| E04 | Northwind Finance BV | E02 | RATINGS | NL |
| E10 | Halden Bank AG | E09 | RATINGS | DE |
| E11 | Halden Leasing SA | E10 | RATINGS | FR |
| E1013 | Pisol Pharma BV | E1004 | RATINGS | NL |
| E1033 | Kunid Pharma SA | E1004 | RATINGS | ES |
| E1066 | Lolil Industries SA | E1004 | RATINGS | ES |
| E1006 | Soson Airlines Inc | E1005 | RATINGS | US |
| E1098 | Wirim Water Inc | E1006 | RATINGS | US |
| E1110 | Rinar Industries SA | E1007 | RATINGS | ES |
| E1177 | Kiver Capital AG | E1010 | RATINGS | DE |
| E1149 | Honel Shipping BV | E1013 | RATINGS | NL |
| E1059 | Kelim Media SA | E1015 | RATINGS | CV |
| E1047 | Vaved Pharma plc | E1020 | RATINGS | GB |
| E1330 | Niner Pharma Finance SA | E1021 | RATINGS | NL |
| E1228 | Cevad Chemicals plc | E1023 | RATINGS | GB |
| E1183 | Danad Pharma plc | E1025 | RATINGS | GB |
| E1331 | Tulol Shipping Finance BV | E1025 | RATINGS | FR |
| E1046 | Ditin Shipping Inc | E1026 | RATINGS | US |
| E1095 | Hunel Foods Inc | E1027 | RATINGS | US |
| E1337 | Lanon Telecom Finance plc | E1038 | RATINGS | GB |
| E1326 | Witad Steel Finance BV | E1052 | RATINGS | FR |
| E1292 | Bavon Industries plc | E1061 | RATINGS | GB |
| E1114 | Verod Logistics plc | E1063 | RATINGS | GB |
| E1215 | Penen Retail Inc | E1063 | RATINGS | US |
| E1197 | Kaval Property plc | E1066 | RATINGS | GB |
| E1332 | Sanin Mining Finance SA | E1068 | RATINGS | FR |
| E1329 | Ganen Shipping Finance plc | E1069 | RATINGS | FR |
| E1075 | Nilim Industries Inc | E1071 | RATINGS | US |
| E1271 | Rarid Logistics AG | E1071 | RATINGS | DE |
| E1174 | Fivel Retail SpA | E1073 | RATINGS | IT |
| E1338 | Hivor Industries Finance BV | E1073 | RATINGS | GB |
| E1273 | Furer Property SA | E1074 | RATINGS | ES |
| E1276 | Nevil Holdings SpA | E1074 | RATINGS | IT |
| E1089 | Hanir Airlines SA | E1078 | RATINGS | GR |
| E1333 | Gilen Capital Finance plc | E1082 | RATINGS | NL |
| E1101 | Doror Telecom SA | E1083 | RATINGS | VD |
| E1325 | Poval Chemicals Finance SA | E1084 | RATINGS | FR |
| E1248 | Hivod Mining Inc | E1107 | RATINGS | US |
| E1327 | Nuner Holdings Finance plc | E1119 | RATINGS | GB |
| E1179 | Cotan Foods SA | E1162 | RATINGS | ES |
| E1293 | Datod Airlines plc | E1166 | RATINGS | GB |
| E1336 | Navor Holdings Finance SA | E1176 | RATINGS | GB |
| E1191 | Boler Steel SA | E1177 | RATINGS | FR |
| E1275 | Fusin Steel Inc | E1189 | RATINGS | US |
| E1233 | Kavid Industries AG | E1198 | RATINGS | DE |
| E1335 | Belor Telecom Finance plc | E1234 | RATINGS | NL |
| E1339 | Wivin Airlines Finance SA | E1241 | RATINGS | NL |
| E1328 | Palad Mining Finance BV | E1244 | RATINGS | GB |
| E1334 | Votim Industries Finance BV | E1260 | RATINGS | FR |
| E1315 | Wetid Shipping AG | E1278 | RATINGS | DE |
Run more queries, or give the final answers.The model
```sql
with ent as (select e.*, coalesce(lei,entity_id) k from entities e where source_system<>'QA'),
canon as (select k, min(case when source_system='RATINGS' then entity_id end) id, coalesce(max(case when source_system='RESEARCH' then country end), min(case when source_system='RATINGS' then country end)) ctry from ent group by k),
st as (select c.id, c.ctry, a.*, row_number() over (partition by c.id, a.rating_type, a.ccy_basis order by a.date desc, a.action_id desc) rn
from rating_actions a join ent e on e.entity_id=a.rated_id join canon c on c.k=e.k where a.date<='2026-10-01')
select 'rwn' q, string_agg(distinct id, ',') v from st where rn=1 and rating_type='LTIDR' and watch='RWN'
union all select 'lostrating', string_agg(distinct id, ',') from st s where rn=1 and rating_type='LTIDR' and rating='WD' and not exists (select 1 from st t where t.id=s.id and t.rating_type='LTIDR' and t.rn=1 and t.rating<>'WD')
union all select 'ceil_eq', string_agg(f.id||':'||f.rating||'/'||cc.rating||'/'||f.ctry, ',') from st f join st cc on cc.rating_type='CC' and cc.rn=1 and cc.id=f.ctry where f.rn=1 and f.rating_type='LTIDR' and f.ccy_basis='FC' and f.rating=cc.rating
union all select 'above', string_agg(f.id||':'||f.rating||'/'||cc.rating, ',') from st f join st cc on cc.rating_type='CC' and cc.rn=1 and cc.id=f.ctry where f.rn=1 and f.rating_type='LTIDR' and f.ccy_basis='FC' and f.rating<>'WD' and array_position(['AAA','AA+','AA','AA-','A+','A','A-','BBB+','BBB','BBB-','BB+','BB','BB-','B+','B','B-','CCC','CC','C','RD','D'],f.rating) < array_position(['AAA','AA+','AA','AA-','A+','A','A-','BBB+','BBB','BBB-','BB+','BB','BB-','B+','B','B-','CCC','CC','C','RD','D'],cc.rating);
```Query results
Query 1:
| q | v |
|---|---|
| rwn | E1037,E1317,E1209,E1242,E1264,E1019,E1006,E1203,E1146,E1066,E1314,E1323,E1133,E06,E1194,E1088,E1181,E1266,E1059,E1039,E1238,E1061,E1013,E1297,E1132,E1099,E1260,E1267,E1126,E1098,E1109,E1168 |
| lostrating | E1032,E1155,E1159,E1007,E1057,E1253,E1308,E1121,E1205,E1076,E1244,E1316,E1166,E1021,E07,E1041,E1138,E1063,E1140,E1107,E1277,E1062,E1124,E1001,E1172,E1084,E1048,E1218,E1219,E1320,E1206,E1200,E1225,E1233,E1234 |
| ceil_eq | E05:BB/BB/VD,E1126:BB/BB/VD,E1236:BB/BB/VD,E1194:A/A/CV,E15:A/A/CV,E1039:A/A/CV,E1028:BB/BB/VD,E1101:BB/BB/VD |
| above | |
Run more queries, or give the final answers.The model
**Q1.** A-. E01's LTIDR was set at A- by A01 (2024-03-12) and not changed until the A02 downgrade on 2025-06-20.
**Q2.** No. E01's only 2026 actions are A03 and A04, both affirmations. A03 moved the outlook to NEG but kept the rating at BBB.
**Q3.** No. I02 is subordinated and was cut to BB+ by A07, which is speculative grade.
**Q4.** POS. E03 has the same LEI as E02, so it is the same entity. A09 (2025-09-15, E03) is the latest action and sets the outlook to POS.
**Q5.** The holder takes E02's (Northwind Holdings) credit risk. I03 is guaranteed by E02 and is rated A (A10, A11).
**Q6.** The data does not state the reason. E05's FC rating is BB and its LC rating is BBB- (A14, A13). The VD Country Ceiling is BB (A12), which fits a ceiling cap on FC ratings, but no comment says so.
**Q7.** 31 issuers had a DG on an issuer rating in 2026, listed in the JSON. They include E08 (A21, A22) and E10 (A27). After merging same-LEI records and excluding QA records, no other issuer qualifies.
**Q8.** E08. A22 on 2026-07-08 took it to RD, which is a default.
**Q9.** 278. This counts distinct LEIs with a latest LTIDR other than WD on 2026-10-01. Same-LEI duplicates are merged and QA records are excluded.
**Q10.** Depends. E05 is BB on FC (speculative) and BBB- on LC (investment grade).
**Q11.** BBB+. A36 (2024-09-30) set it, and the later RW (A35) left the rating unchanged.
**Q12.** A-. A34 assigned it on 2023-01-15.
**Q13.** 1. A36 is the only DG for E14.
**Q14.** None. E12 was first rated on 2024-02-01 (A30).
**Q15.** A-. E10 is the same entity as E17, and the downgrade to BBB+ came on 2026-04-15, after this date.
**Q16.** No. E14 was BBB+ on 2025-01-01 and is BBB+ now. The RW and the later AF did not change the rating.
**Q17.** No. E06's only 2026 action is an RW (A17), which is not a downgrade.
**Q18.** 32 issuers were on RWN, listed in the JSON. This includes E06 and LC-only watches.
**Q19.** 28 issuers had a NEG outlook, listed in the JSON. This includes E01 and E09.
**Q20.** No. A19 withdrew E07's rating for commercial reasons, which is not a default.
**Q21.** 35 entities, listed in the JSON, have a latest LTIDR of WD and no other current LTIDR. This includes E07.
**Q22.** E08. It is the only entity with an RD or D rating (A22).
**Q23.** F2 (A04).
**Q24.** Yes. E01's FC rating is BBB, which is investment grade.
**Q25.** 66. This counts instruments whose latest INST rating on 2026-10-01 is BBB- or higher. EX actions are excluded.
**Q26.** A+ (A40).
**Q27.** A- (A42).
**Q28.** BBB+ (A38). The CC of A is a cap, not the sovereign's rating.
**Q29.** None. VD has only a Country Ceiling (A12), no issuer rating.
**Q30.** Eight entities: E05, E1028, E1101, E1126 and E1236 at BB (VD ceiling), and E15, E1039 and E1194 at A (CV ceiling).
**Q31.** No. No entity's FC rating is above its country ceiling.
**Q32.** E09. The chain is E11 โ E10 โ E09.
**Q33.** The holder takes E10's (Halden Bank) credit risk. I05 is guaranteed by E10 and is rated BBB+ after A29.
**Q34.** Yes. E12 (Halden Foods) has no parent and is not part of the E09 group. The question is ambiguous on which Halden Foods is meant, so this assumes Halden Bank (E10) is the intended Halden entity and the answer is "no" for Foods. Correction: E12 has no parent link to E09, so they are not in the same group.
**Q35.** 3. The group is E09, E10 and E11. E17 is a duplicate record of E10.
**Q36.** 2. The group is E02 and E04. E03 duplicates E02.
**Q37.** 331. This is the count of distinct LEIs plus the two sovereigns, with QA excluded.
**Q38.** No. They have different LEIs.
**Q39.** A. Both E02 (A08) and E03 (A09) are A.
**Q40.** 66. This is distinct GB-domiciled issuers with a current LTIDR on 2026-10-01, using the RESEARCH country where records disagree.
**Q41.** None. E16 is a QA record and must be ignored.
**Q42.** LU. RESEARCH holds for domicile, and E17 says LU while E10 says DE.
**Q43.** 1. Only the Halden Bank entity (E10/E17) is in LU after applying the RESEARCH country.
**Q44.** Yes. I07 pays in XVD, the domestic currency of VD, the country of E05.
**Q45.** No. I07 is rated BBB- and is local-currency debt, so the BB ceiling does not apply.
**Q46.** No. E11 has only a Credit Opinion (A46), which is not an issuer rating.
**Q47.** None. I08 has only an EX action (A47), so it is not yet rated.
**Q48.** 106. This counts instruments whose latest INST action on or before 2026-10-01 is not EX, and none of them is WD.
```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"]},
"Q8":{"entities":["E08"]},
"Q9":{"count":278},
"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":["E1037","E1317","E1209","E1242","E1264","E1019","E1006","E1203","E1146","E1066","E1314","E1323","E1133","E06","E1194","E1088","E1181","E1266","E1059","E1039","E1238","E1061","E1013","E1297","E1132","E1099","E1260","E1267","E1126","E1098","E1109","E1168"]},
"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"]},
"Q20":{"in_default":"no"},
"Q21":{"entities":["E1032","E1155","E1159","E1007","E1057","E1253","E1308","E1121","E1205","E1076","E1244","E1316","E1166","E1021","E07","E1041","E1138","E1063","E1140","E1107","E1277","E1062","E1124","E1001","E1172","E1084","E1048","E1218","E1219","E1320","E1206","E1200","E1225","E1233","E1234"]},
"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","E1126","E1236","E1194","E15","E1039","E1028","E1101"]},
"Q31":{"any":"no"},
"Q32":{"parent":"E09"},
"Q33":{"risk_of":"E10","rating":"BBB+"},
"Q34":{"same_group":"no"},
"Q35":{"count":3},
"Q36":{"count":2},
"Q37":{"count":331},
"Q38":{"same":"no"},
"Q39":{"rating":"A"},
"Q40":{"count":66},
"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":106}
}
```