Create new column with Existing value on other column in MySQL

edited November 2022 in MYSQL

I have start_date(varchar) column and i want to add new column duplicate_date(date) with values of start_date column


  • Step 1: Add new Column
    ALTER TABLE long_holiday ADD (duplicate_date DATE);
    Step 2: Update new Column with existing value
    UPDATE long_holiday SET duplicate_date = STR_TO_DATE(start_date , '%d-%m-%Y');

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!