Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello. I have to implement some queries base on the below schema for my homework.
SQL
students(student_id, name);
friends(student_id, friend_id);
db_grades(student_id, grade);


The last part is the hardest one, in which we have to calculate the variance without using VAR function.

Return the variance of the student's scores that were less than 10.

What I have tried:

Actually, I just have implemented this part using VAR function, and I could not solve it without it.
I will be grateful for your help.
Posted
Updated 6-May-22 0:53am

The VAR function calculates the statistical variance of values against the mean of a series. If you have to do it manually then you need to research the formula required to do the calculation.

See Standard Deviation and Variance[^]
 
Share this answer
 
v2
The idea of homework is to get you to think about what you have learned, and to teach you to use it in "practical" situations - as well as to check how good your comprehension has been so that remedial action can be taken if necessary. That's why you aren't allowed to use VAR - it's too simple a solution and teaches you nothing about SQL queries.

So, as Richard has said, look at how you calculate a variance, and try to implement it yourself.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900