What is the purpose of Django's annotate method?
Correct answer
A. To perform aggregation functions on querysets
15 views
A. To perform aggregation functions on querysets
15 views
annotate() adds an aggregate value to each object in a queryset, such as a count, sum or average: Author.objects.annotate(num_books=Count("book")).
aggregate() is different: it returns one summary value for the whole queryset.
Practise more Computer Science MCQs with answers and explanations on MCQsExam.com.
Not sure why the answer is A? Ask here and get an explanation.