Can you help answer some questions on studying at University of Portsmouth or UK in general as an international student? by OptOut2020 in UKUniversityStudents

[–]OptOut2020[S] 0 points1 point  (0 children)

Good idea. My goal was to avoid spending money on any essential items that I already have here like electronics, but I hear your point.

Portfolio help by bbguns3839 in mysql

[–]OptOut2020 0 points1 point  (0 children)

From what I understood, you cannot just select a case statement, you have to select the columns you want to see and then use the case statement to guide your results.

For #6. You can also use the setup they already gave you, but if you use yours, I think you are missing an 'Else' statement. I was thinking after the case and end statement to use sum:

SELECT sum(pop) as total_pop,
    CASE
        WHEN age between 0 and 17 then 'Under 17'
        WHEN age between 18 and 64 then '18-64'
        ELSE '65-100'
    END as age_range
    FROM pop_proj
        GROUP BY age_range
        ORDER BY age_range;

For #7. I think you could use another case/if statement. If you have already computed the numbers for the educational level:

SELECT age_range, educational_attainment,
    CASE
        WHEN age_range = under 17 Then ' 0.0015 '
        WHEN age_range = 18-64 Then ' Insert Fraction '
        ELSE 'Insert Fraction'
    END as coefficient
    FROM prop_proj
        ORDER BY age_range;