in Education by
I have a table in my android app with a column named tags, this column can contain one or multiple comma separated values, for example : test1,test,test2 now I want to rename one of these values in entire table, I have the following query : update mytable set tags = replace (tags, ',test,',',XXX,') // rename test with XXX where tags like '%,test,%' this works fine as far as the value is in between commas. How can I achieve this for the situation where my value is at the start or end of the csv or is the only value in csv. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
You need to append commas at the start and at the end of the column and operate on that: update mytable set tags = trim(replace(',' || tags || ',', ',test,', ',XXX,'), ',') where ',' || tags || ',' like '%,test,%'; See the demo

Related questions

0 votes
    I would like to take a list of names (e.g. john, mary, paul) and create a SQLite "select" ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    I have a dataframe as below itm Date Amount 67 420 2012-09-30 00:00:00 65211 68 421 2012-09-09 00 ... solutions would be appreciated. Select the correct answer from above options...
asked Jan 28, 2022 in Education by JackTerrance
0 votes
    Shown below is the input NumPy array. Delete column two and replace it with the new column given below....
asked Apr 24, 2021 in Technology by JackTerrance
0 votes
    I have a csv file and I am reading this file in python using pandas. I want to read each row of ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 21, 2022 in Education by JackTerrance
0 votes
    What is the default value used by sqoop when it encounters a missing value while importing form CSV file. A - NULL B - null C - space character D - No values...
asked Jan 13, 2021 in Technology by JackTerrance
0 votes
    I need to use environment variable "PATH" in yaml file which needs to be parsed with a script. ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 10, 2022 in Education by JackTerrance
0 votes
    Here is my test SQL: declare @Table table (strField nvarchar(6), xmlField xml) insert into @Table values ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    ii) to find the largest value within the cell range starting from row 1 column A to row 25 column B [1+1] Select the correct answer from above options...
asked Dec 1, 2021 in Education by JackTerrance
0 votes
    Take from a pack of cards all the Aces, Kings, Queens and Jacks. Arrange them in a 4 × 4 square so that every ... and one card of each suit (Heart, Spade, Diamond, Club)....
asked Feb 11, 2021 in Education by JackTerrance
0 votes
    I need a standard deviation function in SQLite. I have found one here: http://www.sqlite.org/contrib ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    Individual R objects can be saved to a file using the _____ function. (a) save (b) put (c) save_image ... Operations of R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    At least according to a description of Mono's exception handling implementation, all the x86 registers are ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 10, 2022 in Education by JackTerrance
0 votes
    Html document must always be saved with: (a) .html (b) .htm (c) .doc (d) Both .html ... Web Fundamentals topic in division Database Programming Techniques of Database Management...
asked Oct 10, 2021 in Education by JackTerrance
0 votes
    Which configuration setting specifies the file to which RDB snapshot dump is saved to _?...
asked Apr 12, 2021 in Technology by JackTerrance
...