How to use SQLite with C# to deal with cardinality?
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.
Cardinality refers to the number of columns in table which is the wrong approach. Create a teach table and pupils. Create another table that has the teacherId and the PupilId. It is up to you to write logic that queries this table and applies your requirement of 5 to 30 students.
Sign in to comment