Many to Many Relations | Backendless Database Training Course (pt. 39)

Опубликовано: 03 Ноябрь 2024
на канале: Backendless
215
7

In this video, we discuss many-to-many relations. We start by explaining the nature of many-to-many relations and providing some examples. We then show how to implement a many-to-many relationship in Backendless by declaring a one-to-many relationship. We also explain how the bi-directional nature of the relationship in Backendless makes it a many-to-many relationship. We then demonstrate how to use this relationship for various use cases, such as getting all students for a course or getting all courses for a student. To help you follow along, we provide a sample database containing data for courses and students, which viewers can import into Backendless (see below).

Next, we explain how to sort courses by the number of students enrolled in them. To do this, we introduce the "count" function, which can be applied to relationships. We demonstrate how to use this function by requesting a specific property using a dynamic function. We explain that to get the number of students enrolled in each course, you need to count all the students in every single course using the count function. We also group the data by individual courses, which makes the aggregated data more useful.

We also explain how to sort the courses by popularity using the Sorting function. We then demonstrate how to get courses sorted by student enrollment in the form of a Codeless block. Finally, we review the use case of getting the students sorted by how many courses they are enrolled in, where we get a list of students ordered by the number of courses they are enrolled in.

Download the sample database shown in the video here:
https://www.backendless.us/databaseco...

Have questions? Post them in the comments below or get in touch at:
Support forum: https://support.backendless.com/
Slack channel: https://backendless.slack.com/
Telegram channel: https://t.me/backendless_chat

Start with Backendless for free today to follow along with this course: https://develop.backendless.com/regis...

Happy Coding!
#database #relationaldatabase