-- Top 10 SchoolsSELECT
school_name,
SUM(avg_math_score + avg_reading_score + avg_writing_score)
AS average_SAT
FROMpublic.nyc_schoolsGROUP BY school_name
ORDER BY average_SAT DESCLIMIT10;
Result
"school_name"
"average_sat"
"Stuyvesant High School"
"2144"
"Staten Island Technical High School"
"2041"
"Bronx High School of Science"
"2041"
"High School of American Studies at Lehman College"
"2013"
"Townsend Harris High School"
"1981"
"Queens High School for the Sciences at York College"
"1947"
"Bard High School Early College"
"1914"
"Brooklyn Technical High School"
"1896"
"High School for Mathematics Science and Engineering at City College"
"1889"
"Eleanor Roosevelt High School"
"1889"
How are the NYC boroughs ranked?
Query
SELECT
borough,
COUNT(*) AS num_schools,
SUM(avg_math_score + avg_reading_score + avg_writing_score) /COUNT(*)
AS avg_borough_sat
FROMpublic.nyc_schoolsGROUP BY borough
ORDER BY avg_borough_sat DESC;
Result
"borough"
"num_schools"
"avg_borough_sat"
"Staten Island"
"10"
"1439"
"Queens"
"69"
"1345"
"Manhattan"
"89"
"1340"
"Brooklyn"
"109"
"1230"
"Bronx"
"98"
"1202"
Note:
The score for Staten Island has the highest average SAT scores among all boroughs. However, it's misleading since there are only ten schools in this borough.
Which are top 5 schools in Brooklyn which have the best math performance?
Query
SELECT
school_name, avg_math_score
FROMpublic.nyc_schoolsWHERE borough ='Brooklyn'ORDER BY avg_math_score DESCLIMIT5;