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 6090051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:10:09+00:00 2026-05-23T12:10:09+00:00

Lets say I have a column that has 20 rows (it’s more, but the

  • 0

Lets say I have a column that has 20 rows (it’s more, but the concept will hold true for 20). Right now, the column is uniquely numbered 1-20. I need to figure out a query though that will change that number scheme from sequential, to sequential with just even or odd numbers.

So for example I just need to create a column in a table where it is numbered in even numbers, or odd numbers. So after the update query is run, it would change my column data from 1-20 to 2-40 (even numbers only), or 1-39 (odd numbers only).

I’m sorry if that doesn’t make sense, or if you can’t think of a reason why I’d need that, but in a strange sort of way, I do need it.

EDIT:

Due to the fact that this doesn’t make sense, I’ll try and clarify a little more.

I have a column that is currently ordered 1-10

1,2,3,4,5,6,7,8,9,10.

I want to execute an update query on the column so that it looks like this:

1,3,5,7,9,11,13,15,17,19

or

2,4,6,8,10,12,14,16,18,20

Is there an update query that I could run to do that?

  • 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. Editorial Team
    Editorial Team
    2026-05-23T12:10:10+00:00Added an answer on May 23, 2026 at 12:10 pm

    For even numbers:

    UPDATE YourTable
       SET YourColumn = YourColumn * 2;
    

    For odd numbers:

    UPDATE YourTable
       SET YourColumn = YourColumn * 2 - 1;
    

    You can only run into trouble if your DBMS starts checking the column for uniqueness too soon, which is ultimately a flaw in (or limitation of) the DBMS. That is: while the ‘even’ update is running, there might be an as-yet-not-updated row containing value 2 as well as an already-updated row containing value 2 (originally 1). If the DBMS enforces uniqueness at each row, this will fail; but the DBMS is not supposed to do that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say I have a table in MySQL called articles, that has a column
Lets say I have a table that has a bit column named Active .
Lets say you have a DataTable that has columns of id, cost, qty: DataTable
lets say I have a xls sheet with just one column which has the
Lets say I have 2 columns in my data Grid: Column A: Selected, and
Scenario: I have a fairly generic table (Data), that has an identity column. The
I have a DataGridView that is bound to a DataTable, it has a column
Simple (I hope), HTML question. Let's say I have a column group that spans
I have data in some text file which has let's say 10000 rows and
I have a DateTime column. I want to extract all records, lets say, from

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.