CyanBook
CyanBook

Reputation: 136

Delete some characters from a column in MySQL

I have ONE column in MySQl table which contains this format:

https://open.spotify.com/track/AAABBBCCC

and I'd like to leave just AAABBBCCC, and not the entire column! The last parte is always the same.

Is that possible? Thanks and sorry for my english!

Upvotes: 0

Views: 105

Answers (2)

nbk
nbk

Reputation: 49373

Use REPLACE to delete the wanted text from your column:

UPDATE Table1 SET Column1 =  REPLACE(Column1,'https://open.spotify.com/track/','')

Upvotes: 1

Mathieu Guyot
Mathieu Guyot

Reputation: 997

You can use SQL REPLACE function to do that.

UPDATE your_table_name
SET your_column_name = REPLACE(your_column_name, 'https://open.spotify.com/track/', '')

For more information you can read SQL statement to remove part of a string

Upvotes: 3

Related Questions