It is possible to standard/convention based on how the posts ought to be purchased in the phrase a database table, and when what exactly may be the motivation for your standard? (pros/cons)

For instance, if the primary key function as the first column? If the foreign secrets directly stick to the primary key or whenever they go in the far right on the table?

If there's a noticeable difference between conventions for various DBMSs, the DBMS within this situation is Microsoft SQL Server 2005.

Thanks /Erik

I'm not conscious of any standard, but the way you structure our colums is

  1. Primary key(s)
  2. Any foreign secrets
  3. Data

Our large data posts, like comments, they fit in the finish. It causes it to be simpler to see just as much data as you possibly can within the Query Analyzer without needing to scroll right.

I usually structure my tables such as this:

  1. Primary key(s)
  2. 'Tracking' posts (DateModified, ModifiedBy and the like)
  3. Any foreign secrets
  4. Data

I am unsure about set conventions but we always place the ID/Primary key column because the first column within the table. I guess it is simply since it causes it to be clearer to determine the pk. I'd say also follow by using fk fields but next there is no real standard, you can maybe get it done by datatype?

Also, this is not a collection out best practice, only a personal choice.

None which i are conscious of. You could re-order the posts throughout a choose anyway, therefore it hardly matters unless of course there's some truly obscure optimisation that you can do on some databases by ordering your posts properly.

There's no official standard that I am conscious of, however the normal practice would be to place the primary key first (it's often a surrogate) after which group another fields by functionality. So inside a "person" table you might group the fields that contains the individual's address data together. Many people add FKs, indexes along with other constraints outdoors the table definion proper.

mm.. When I know you will find no restrictions. Its only a matter of clearness.

To be sure with the majority of the posts above, primary key first (a minimum of). The relaxation is personal preference. For those who have a typical then stick to that standard.

Ladies to help keep posts fairly realistically together. A fully normalised data structure isn't appropriate so you've "minor organizations" saved on a single table (i.e. not getting rid of NULLs). A good example will be the address fields, or even the different telephone, cell phone, work phone posts placed together.

Probably the most striking example I'm able to give is What Not Get It Done. If your developer autogenerates a schema and also the posts are produced from a to z (as well as the PK was hidden in the center of the table structure) then that's MOST annoying.

According to edoode:-

Primary key(s) 
'Tracking' columns (DateModified, ModifiedBy and such) 
Any foreign keys 


Fixed width 'not null' columns
Fixed width 'nullable' columns
Variable Width columns VARCHAR NVARCHAR etc.

You receive a tiny weeny very slight performance increase should you stick posts that could vary long at the end on the table.