Currently I have some table table need to be clean up.
Id | FirstName | Last Name | Created_On | |
---|---|---|---|---|
R1 | Jack | NULL | [email protected] | 2024-08-01 |
R2 | Mandy | Rose | NULL | 2024-08-02 |
What I plan to do is to update my table data for all firstName, lastName, and email column data become the value same as Id, but those column is NULL remain as usual. Is there any simple and faster way I can check the column is NULL or not when I do the update statement?
I only know I can update the column value to same as Id with using query below. but not sure how can I check EVERY column of different row of data if it is null or not.
UPDATE profile_table
SET FirstName = Id, LastName= Id, Email = Id
WHERE Created_On >='2024-08-01'
My target outcome:
Id | FirstName | Last Name | Created_On | |
---|---|---|---|---|
R1 | R1 | NULL | R1 | 2024-08-01 |
R2 | R2 | R2 | NULL | 2024-08-02 |
Anyone can give some guide on these? Thank you so much.