0

I am trying to display all the people who name Jason, and replace Jason to Jill.

However, I tried the following SQL statement is not working

SELECT * FROM DigitalTV WHERE REPLACE('Jason', 'ason', 'ill');
0

1 Answer 1

1

Assuming that the column you want to replace names is called NAME, you can use a query like:

SELECT 
  *,
  REPLACE(NAME, 'ason', 'ill') As CHANGED_NAME
FROM DigitalTV 
WHERE NAME='Jason';`

This will bring an extra column with the name CHANGED_NAME. If you do not want it, use each and every column name in the selector but NAME. It should be modified as REPLACE(NAME, 'ason', 'ill')

Sign up to request clarification or add additional context in comments.

2 Comments

Since we know NAME='Jason', you could SELECT 'Jill' AS CHANGED_NAME. (No REPLACE necessary).
I currently have two columns, first_name, last_name. I want to make sure I can replace 'Jason' to 'Jill' in both columns

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.