https://learninghub.kx.com/forums/topic/kxsql-question-6
For Question 6 Show the average marks per house using SQL Join, call the new column avg_mark. This new value should be rounded down (i.e. contain no decimal values).
i have inputted this query
ex6:"SELECT house,FLOOR(AVG(mark)) AS avg_mark FROM results JOIN students GROUP BY house".
i am passing 2 categories on correct syntax and table structure but failing on correct record, any advice on how i can overcome this as i have tried everything
Hi @masmail
I've noticed a few things from your screenshots:
If you take a look at the challenge.quke file, you will see the correct answer should be as follows (screenshot below). So you don't seem to have the correct values.
The problem lies in your table join. To be able to join two or more tables, you must use a related column. In this case our related column is 'student_no'.
To do this I'm going to use an INNER JOIN:
"INNER JOIN students ON results.student_no = students.student_no"
Also to achieve the correct value when rounding I advise you use ROUND instead of FLOOR.
Hope this helps!
Thanks,
Megan