Sql

Rebecca P.

asked • 12/04/20

What am I not doing to return 16 states in an alias field?

--Write a query that returns a field called below_average_states_y2000

--that lists all states

--with an avg_math_4_score less than the average over all states

--in the year 2000

I've rewritten this many ways and have tried subquerying but I'm too tired to keep trying to get this to run right...out of time...exam in the am.

SELECT AVG(avg_math_4_score) AS avg_4, state AS below_average_states_y2000

FROM naep

WHERE year = '2000'

GROUP BY state

HAVING avg_math_4_score < AVG(avg_math_4_score) AS avg_4;

1 Expert Answer

By:

Amedeo F. answered • 12/14/20

Tutor
5 (11)

SQL Server and Data Analytics Developer with 20 years experience

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.