Students Scoring Above Average
Updated
Problem statement
The student table has one row per student. id is the student's unique ID, name is their name, and score is their math score.
Write a query that returns the id and name of every student whose score is higher than the average score of all students. A score equal to the average does not count.
Sort the result by id from smallest to largest.
Table schema
MySQLPostgreSQLPandas
Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.
student
One row per student with their math score.
| Column | Type | Nullable | Description |
|---|---|---|---|
| idPK | Integer | No | — |
| name | Text | No | — |
| score | Decimal | No | — |
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| id | Integer | No | — |
| name | Text | No | — |
Row order: must match exactly. Numeric tolerance: 0.
Constraints
- The
studenttable has from1to1000rows. idis unique and1 <= id <= 10^6.nameis one uppercase English letter followed by 0 to 19 lowercase English letters. Names can repeat.0 <= score <= 100, with at most 2 digits after the decimal point. Scores can repeat.- No value is
NULL.
More Capstone Investment Advisors Online Assessment questions
Similar questions at other companies
- Bond Interest Summary Above 3%Wells Fargo · OAWells Fargo interview questions
- Employee Promotion OpportunitiesIntuit · OAIntuit interview questions
- Students and Their SubjectsBirla Pivot · OA
- Companies with Average Salary Above 40000AT&T · OAAT&T interview questions
- Build Taxi Driver Performance FeaturesBoston Consulting Group · OABoston Consulting Group interview questions
- Weekend Appointments for Consular Services ReschedulingMcKinsey & Company · OAMcKinsey & Company interview questions
- Companies Above a Salary ThresholdVerisk · OA
- Customer Resource Usage AnalysisIBM · OAIBM interview questions
- Customers Who Never OrderedAccenture · OAAccenture interview questions
- First Duplicate Transaction Within Ten MinutesLenskart · OA