mysql - Auto erase table data in php myadmin -
i'm developing feedback form, students allowed give feedback on particular subjects. have table 3 fields "id, unique no, password", students admission number stored. here want. each students completes giving feedback, particular data's table must deleted automatically. please help.
this can done join
, i'll demonstrate trigger here, because mentioned in comment above.
i assume you've got table store students feedback data. let's call students_feedback
, other students_admission
example.
using mysql triggers, assing database delete student admission data automatically on insert
. you'll want use on create, because feedback data stored in students_feedback table, insert event triggered.
so, example:
create trigger delete_admission after insert on students_feedback each row begin delete students_admission students_admission.id=old.id limit 1; end;
use whatever delete query want here.
note: before mysql 5.0.10, triggers cannot contain direct references tables name.
Comments
Post a Comment