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

  • Home
  • SEARCH
  • 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
  • 0 Views
  • 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 was given a MySQL database file that I need to restore as a
For a given form in a database, is there a quick/easy way to find
I was given a task to display when a record in the database was
Given a model's instance object, how can I get the database table's name? I
Given the following XML: <databases> <database> <title_display>Aardvark</title_display> </database> <database> <title_display>Apple</title_display> </database> <database> <title_display>Blue</title_display> </database>
I need to test whether various types of database objects exist in a given
Does anyone know a way to auto-generate database tables for a given class? I'm
I have converted a database from MySQL to Firebird, all tables name and field

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.