How can I change the default value of an existing column with a value from another column?

Task: there are columns id and order , it is required that initially id and order are identical, then it is possible to change the value of order for sorting.

  • ID - probably autoincrement? - Akina
  • yes, id auto increment - Ravil
  • Use the trigger AFTER INSERT - Zhukov Roman
  • can be an example if not difficult. Not very well know the syntax and I fear for a long time to dig. - Ravil
  • one
    @ZhukovRoman It will not work. In the AFTER trigger, you cannot change the NEW table. In a trigger, it is impossible to execute an UPDATE of a table on which a trigger is triggered. - Akina

0