Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 54937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:17:56+00:00 2026-05-10T17:17:56+00:00

Given a database field named widget_ids, containing data like 67/797/124/ or 45/, where the

  • 0

Given a database field named ‘widget_ids’, containing data like ’67/797/124/’ or ’45/’, where the numbers are slash separated widget_ids… how would you make an update statement with SQL that would say: ‘if the widget_ids of the row with id X contains the text ‘somenumber/’ do nothing, otherwise append ‘somenumber/’ to it’s current value’

Can you do something like that with SQL, or more specifically, sqlite? Is that something that is better done in the program for some reason or is there support for ‘if-then’ like syntax in SQL?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T17:17:56+00:00Added an answer on May 10, 2026 at 5:17 pm

    Updates are kind of like if-thens themselves, and there is also if-then support of some sort in most SQL implementations. A simple solution might be:

    update <tablename>   set widget_id = widget_id + 'somenumber/'   where row_id = X     and widget_id not like '%/somenumber/%'     and widget_id not like 'somenumber/%'; 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If the amount of data stored within a given field of a database is
Given a table named person (in a MySQL database/schema), kind of like this one:
I have a number mysql database field named numbers in which there are 10
I have a database with a name column having data like 'Very big News'
I have a field in a 2003 access database named first. I run the
Using .NET's DbConnection.GetSchema(), how do I find the owner of a given database? Alternatively,
Given a database with two tables X and Y , I have a query
Given a database that has numerous repeating columns used for auditing and versioning, what
Given a [mysql] database with a given schema, is it possible to generate an
I was given a MySQL database file that I need to restore as a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.