There is no syntax for inserting multiple lines, where one line affects certain fields, and another line affects other fields.
Each INSERT must specify the columns to be inserted, and all values will refer to those columns.
In the background, for each line to refer to different fields, we would have to explain to each line what should be done, so in the background this is reduced to the problem of making an INSERT for each situation. Since in this case, I agree that there is a simplification, because the columns not to be inserted would always be the last ones, so it would be like sending a shorter list of values. Anyway, it’s not possible.
However, the restriction that you cannot send NULL or empty string does not make much sense. For, if the database agreed to provide fewer columns in the INSERT, it would mean that the other columns would receive a default value when entering the record in the database. Normally this value would be NULL even, so why not put it in INSERT itself?
Perhaps another solution would be to renormalize the database to have, on the one hand, the attributes of the person in a table, containing name and age. And, in another table, the description of the grade ('Note 1', 'Note 2'), etc and its value, in addition to the student’s identification. So notes could be inserted only when available.
Someone could, for example, have grades 2 and 3 but not have the 1?
– anonimo
Yes. Students can have 1 of the 3, none and so on.
– Caio Henrique Reblin
If the missing note can be any of the three I do not see how you inform such a situation other than by not informing the (s) field(s) corresponding to(s) the missing note(s) in the field list or by informing NULL in the value list (s) corresponding to(s) to(s) note(s) absentee(s). There’s no way the BDS knows without you explicitly informing.
– anonimo
So there’s no way to do what I want?
– Caio Henrique Reblin