Skip to content
Advertisement

Use the value of an attribute from another table as a default value of an attribute from another table in MYSQL

I wanted to use the value on student_lastname in table tbl_student as a default value of sis_password in table tbl_sis_account but I am out of idea on how to do it. I tried putting “Select query” after the “Default” but it doesn’nt work, anyway here’s the sql:

Advertisement

Answer

I’ve figured the solution for this problem, for a while now. Forgot to post the answer though, coz I am no longer using this method. But here’s what I did.

On the tbl_student I created a “After Insert trigger

so the inserted result on tbl_sis_account is

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement