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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:35:38+00:00 2026-05-13T12:35:38+00:00

When it comes to column order in DB tables, are there any standards or

  • 0

When it comes to column order in DB tables, are there any standards or at least best practices?

Here’s a handmade convention that I follow:

  • primary key (i.e. id);
  • unique columns (i.e. email, ssn);
  • foreign keys (i.e. article);
  • columns holding user generated data (i.e. first_name, last_name);
  • columns holding system generated data;
    • non-boolean (i.e. password_hash);
    • boolean (i.e. deleted, verified)
  • timestamp columns (i.e. created_at);

These leave many questions unanswered, though, so I’d like to hear your thoughts.

  • 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-13T12:35:39+00:00Added an answer on May 13, 2026 at 12:35 pm

    In short, you’ve stated the standard conventions well and you’re not missing a lot. IMO, the only move that would make someone look unprofessional would be not having the Primary Key(s) first. Having the foreign keys come right after that is a nice convention, but not a big deal. (Multi-field primary keys that include foreign keys should of course be at the very beginining, or someone should be beaten.) I would add two additional thoughts:

    1. Have fields with similar themes near each other. Having City/State/Zip fields widely separated would be unhelpful, for example. I think it would not matter in the slightest whether user_role or user_ip came first, but they sound like they should be next to each other.
    2. Secondary to other such conventions, it doesn’t hurt for things to be alphabetical.

    Having additional conventions within your database is a very good idea (like as you mention always having the timestamp at the end). If you have ChangeDate and ChangeBy fields in a lot of your tables, having them (obvously next to each other and) consistently located is good.

    Additionaly, ErikE mentioned that there can be some efficiency to having, at the end of your table, the variable length fields (varchar, nvarchar) that might often contain nulls. Other than that, I don’t think there are any performance advantages to arranging things a certain way in modern relational databases.

    Naming

    Often when you’re deciding column order is the same time you’re deciding on column names, so I’d like to address that a little. You can certainly make horribly, costly mistakes with the naming of your fields; this is much more important than your column ordering. Ordering can be changed easily, but poor names will cause you problems forever. It’s a huge pain to change table/column names a year later when there’s dozen’s of references to them. I just added an answer here to address this very important topic.

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

Sidebar

Related Questions

is there any way to use defined column name in SELECT statement with WHERE
is there any way to use defined column name in SELECT statement with WHERE
Crystal Reports in Visual Studio 2008 with C# Normally Data from single column comes
Android comes with lots of system resources ( android.R ) that can be used
Here comes a simple question, for all those who know javascript. I made an
Issue comes up when i try to unload plugin that is loaded and load
This scenario comes up often, now that I use LinkToSql and the classes it
Besides what it comes with in 2.0 (the generated aspnetdb.mdf), is there a standard
The titles says it. I want a 2-column CSS layout that: is centered -
I want to select values from three tables. Each table has an buyer_entity_id column.

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.