Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Summarize Survey Ratings by Question

EasySQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is Summarize Survey Ratings by Question. Start with the requirements and the one table on the right.

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.

Problem

You are given customer feedback survey responses collected for Elsevier products such as ScienceDirect and Scopus. Write a SQL query to summarize the survey results for each survey question by returning the question text, the number of non-null ratings submitted, and the average rating. Only include rows where rating_score is not null, and sort the results by average rating descending and then by question text ascending.

Schema

customer_survey_responses
ColumnTypeDescription
response_idPKINTUnique identifier for each survey response row
product_nameVARCHAR(100)Elsevier product associated with the survey response
question_textVARCHAR(255)Survey question answered by the customer
rating_scoreINTRating score from 1 to 5; null if the question was skipped
submitted_dateDATEDate the survey response was submitted
Tablescustomer_survey_responses
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results