Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Second-Highest Rating Change Query
00:00
5 left

Second-Highest Rating Change Query

MediumSQL · PostgreSQL

Problem

Write a query to find the second-highest credit rating change for a specific issuer within a given fiscal year.

Use Acme Holdings and fiscal year 2024 for this exercise. Return all changes tied at the second-highest distinct value, ignoring rows where the rating change is NULL.

Output

  1. One row per qualifying rating change, with change_id, issuer_name, fiscal_year, and notch_change.
  2. Include only Acme Holdings changes from fiscal year 2024 with non-NULL notch_change values.
  3. Sort by change_id ascending.

Schema

issuers
ColumnTypeDescription
issuer_idPKINTUnique issuer identifier
issuer_nameVARCHAR(100)Issuer legal or reporting name
sectorVARCHAR(60)Issuer industry sector
rating_changes
ColumnTypeDescription
change_idPKINTUnique rating change identifier
issuer_idINTIssuer associated with the rating change
fiscal_yearINTFiscal year of the rating change
previous_ratingVARCHAR(10)Rating before the change
new_ratingVARCHAR(10)Rating after the change
notch_changeNUMERIC(5,2)Numeric magnitude of the rating change
change_dateDATEDate of the rating change
Tablesissuersrating_changes
Interviewer

Your question is Second-Highest Rating Change Query. Start with the requirements and the two tables in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
Sign up free to run your codeLog inLn 1
Run your query to see results here.