Home > database >  MySQL
MySQL

Time:09-17

There are two tables a student there is building, dormitory, tables, and there is already live in a dorm list, when the table to insert data to the student dormitory table number plus one, when this how to implement?

CodePudding user response:

The trigger
When the student table insert
Dormitory table number + 1
When the student table delete
Dormitory table number 1


CodePudding user response:

1/f, reference to learning - turn reply:
triggersWhen the student table insert
Dormitory table number + 1
When the student table delete
Dormitory table number 1

I know with the trigger but don't know how to write the

CodePudding user response:

refer to the second floor weixin_45809881 response:
Quote: refer to 1st floor to learning - turn reply:
triggersWhen the student table insert
Dormitory table number + 1
When the student table delete
Dormitory table number 1

I know with the trigger but don't know how to write the

The use of the mysql trigger that you have to baidu