question

EdouardDurand-3527 avatar image
0 Votes"
EdouardDurand-3527 asked AgaveJoe commented

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

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.

dotnet-csharpdotnet-sqlite
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

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.

1 Vote 1 ·

0 Answers