How to use SQLite with C# to deal with cardinality?

Edouard Durand 1 Reputation point
2021-07-05T10:41:30.84+00:00

Hello,

I have a Teacher table and a Pupils table.
A teacher can have 5 to 30 students and a student can have only one teacher. With SQLite, how can I check this cardinality with an SQL query?

For example, how do you prevent a user from adding more than 30 students to the Teacher table or from assigning multiple teachers to a student?

Thank you for your help.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,710 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,245 questions
{count} votes