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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:00:39+00:00 2026-05-31T20:00:39+00:00

All tables in my database always have an id (autoincrement), at column 0 regardless

  • 0

All tables in my database always have an id (autoincrement), at column 0 regardless of its name, it’s always there.

So, in table teste I probably have idTeste, in table cars I should have idCars, but the format is not a standard, I could have a table example with a column simply called id.

I’m trying to create a generic update like:

update tablename set bla='ble' where column[0]='id';

so, don’t matter the column’s name, I wish to reference it by its id. Is that possible?

I know I can do something like:

show columns from table

and pick the first name before execute my update, and, in fact, I did that to solve my problem, but I’m curious if it was possible.

  • 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-31T20:00:40+00:00Added an answer on May 31, 2026 at 8:00 pm

    What you’re after is called the ordinal position, or simply “ordinal”.

    SQL does not support using ordinals in the WHERE clause. Support for ordinals differs between database vendors — the most common support is in the ORDER BY clause:

    ORDER BY 2, 1
    

    …which relies on the column(s) listed in the SELECT clause. Some support ordinals in the GROUP BY clause.

    That said, using ordinals is not a recommended practice because it’s dependent on the order of the columns in the SELECT clause. If that order changes without the ORDER BY/etc being updated, you won’t know until runtime.

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

Sidebar

Related Questions

Is there a SQL command that will list all the tables in a database
I have a 5GB database, all tables are MyISAM. It runs into heavy load
I have 3 database tables, all of them have the same 5 columns. They
Is there an easy way to reset a django database (i.e. drop all data/tables,
How can I empty the contents of all tables in my database in phpMyAdmin
How do I query an Oracle database to display the names of all tables
By fiscal year I mean all the data in the database (in all tables)
I'm converting database from Teradata to SqlServer. I've noticed all tables and procedures are
I'm using MySQL 5.1 and Susbsonic 3.0.0.3. Database and all tables are in cp1251.
How do I get a list of all the tables defined for the database

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.