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
Rank Papers by Discipline
00:00
5 left

Rank Papers by Discipline

EasySQL · PostgreSQL

Problem

Elsevier uses discipline-level citation analytics to compare papers indexed in Scopus. Write a PostgreSQL query that counts citations for each paper and ranks papers within their academic discipline.

Requirements

  1. Include every article associated with a valid discipline, including articles with zero citations.
  2. Calculate each article's citation count from the citations table.
  3. Return both RANK() and DENSE_RANK() rankings within each discipline, ordered by citation count descending.
  4. Sort the final output by discipline name, citation count descending, and article ID.

Representative Sample Data

articles: 101, “RNA Folding in Cells”, Biology; 102, “Plant Genome Networks”, Biology; 107, “Graph Neural Models”, Computer Science; 108, “Efficient Vector Search”, Computer Science.

citations: three rows for article 101, two rows for article 102, and one row each for articles 107 and 108.

Schema

disciplines
ColumnTypeDescription
discipline_idPKINTEGERUnique identifier for an academic discipline
discipline_nameVARCHAR(100)Name of the academic discipline
articles
ColumnTypeDescription
article_idPKINTEGERUnique identifier for a scientific article
titleVARCHAR(200)Title of the scientific article
discipline_idINTEGERReferences the article's academic discipline
citations
ColumnTypeDescription
citation_idPKINTEGERUnique identifier for a citation record
article_idINTEGERIdentifier of the cited article
Tablesdisciplinesarticlescitations
Interviewer

Your question is Rank Papers by Discipline. Start with the requirements and the three 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.