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

Edouard Durand 1 Reputation point


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.
9,125 questions
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.
7,588 questions
{count} votes