I am learning MYSQL on my own because of the teaching restriction there is in my city and its vicinity, so I would like information on how to use CASCADE in the table I have with this structure:
tblUser idu int not null auto_increment pk name
tblTelephoneN idt int not null auto_increment pk tipotel int not null // identifier to tell if it is cellular etc. numerotel varchar (15)
tblRelacaoUsuTel idu int not null idt int not null
My doubts are as follows:
When doing the main record after reading in a forum that in a transaction we have N routines, I created one for each phone insert (4 phone fields, using Lazarus IDE [Delphi style]), so I have an INSERT INTO ... for each phone and I'm manually inserting the data into the tblTelephoneN and uSuTel tblRelation table, I use LAST_INSERT_ID () for this 'gambiarra'.
How do I proceed with the update, read about CASCADE and how it makes 'linked' changes, can I use CASCADE in any way in my case? (since the user id does not change) or should it only change the field where you have the telephone number in tblTelephoneN and the type of it?
I appreciate the answers and understanding.