Playing around with SQL and found this question in a book I picked up at the library and was attempting to figure it out. Just would like some one who knows more about sql to take a look and see if what I have down will complete what they asked.
Here the question:
There is a table (called Grades) that includes course, firstName, lastName, lastAccessDate, and all of your grades for each assignment and exam (a1, a2, a3, a4, a5, a6, a7, m1, m2, final). Assume that each of my classes has exactly the same distribution of assignments, namely that there are seven assignments, two midterms, and a final.
Write a query that will determine the number of students who have averaged at least an 83 on the two exams and have not yet submitted the final in each of my courses, sorted by the course ascending.
This is my query:
query="
SELECT AVG(m1+m2)
From grades
Where AVG >= "83"
ORDER BY course ASC,
I would say the question is somewhat advanced for one who has just picked up a book.
Writing 'SELECT AVG(m1+m2)' is good. But writing 'Where AVG >= "83"' is not correct syntax of the AVG function.
I am attempting this using RGui 64bit. When I attempt to run it I get this error:
Error in rsqlite_send_query(conn@ptr, statement) : near ")": syntax error
Are you using SQLite? Not sure it supports the syntax I gave you. Since this is a SQL Server forum, I wrote the query for SQL Server. I don't have SQLite handy at the moment to play with that. You might want to try SQLLite forums, though.