.. (לתיקייה המכילה) | ||
Regarding using as few queries as possible... | |
This requirement is only meant for the actual task queries. Each function can be split into two sections: input validation and the actual task. You do not need to minimize the number of queries used for input validation. These queries can and should be separate. The queries you use to actually return the required output (the task queries) should be minimized in the sense that you don't want to make un-necessary queries. This requirement has two goals. First, you should try avoid doing any processing in C and perform as much as possible of the processing in SQL. We've learned from previous semester that attempting to minimize the number of queries also helps in reducing C processing. Second, it helps simulate real world conditions. In a real world scenario the DB server will be remote server which means that each query you perform is another network usage. Obviously, for performance reasons, you would want to minimize network usage during the calculation. As there are many ways to solve each question, there is no one minimal number of queries. The minimum depends on your way of solving the question. If you think you can use less queries, do so. Otherwise, leave it as it is. As long as your solution is reasonable it will be fine. |
Some error cases presented in the exercise can be united. | |
In this course we do not assume that the DB is necessarily sane (which means it does not contain rows representing student/courses which don't exist). Therefore it is required to perform the extra checks to verify the sanity of the DB and validity of all inputs. However we do agree that in normal situations, when the DB is sane, it would probably be enough to just check that the student isn't enrolled to the course. |
In query 11, should the best teachers be the teachers with a single highest grade or the highest grade average? | |
grade average |
Should we avoid views to reduce the number of queries? | |
No you shouldn't. If you have a sub-query that appears several times in a query it should be a view even though it is an extra query just because it is more correct. If you need to change the sub-query it is better to change a the view than go over the entire code and change all the appearances of the sub-query in the code. If a sub-query appears several times, make it a view. if a view is used only once, make it a sub-query. |
in the bestRankers query it says to print the teacher names. is that mistake? shouldn't we print the student names. | |
It is a mistake. Print the student names. |
is the definition of grades for teachers in the 10th and 11th queries the same as in the 9th query? | |
yes |
In query we are asked to count how many students there are for each teacher. | |
Number of students in this course only. |
In unrank, should we make all ranks of that student to that teacher invalid or only the latest one? | |
Make all of the m invalid |