0

I have a table with three columns:

Name Surname NameSuname
Bob  Marley  NULL
John Doe     NULL

I want to insert values from Name and Surname columns into NameSuname column. How can I do that?

1 Answer 1

2

You need to update the coumn instead of inserting

UPDATE MyTable
  SET NameSuname = Name || ' ' || Surname 
Sign up to request clarification or add additional context in comments.

1 Comment

Of course, you combine the 2 by using a trigger that fires after table insert, which will do the update for you, getting you back to the impression that you're only doing an insert. Plus it will be part of the same transaction, thus all fail or all succeed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.