SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    alter table a add b after c

    Hello,

    In mysql, we can add a new column to a table after a specific column, eg: ALTER TABLE table_a ADD column_b int(11) AFTER column_a, what's the equivalent syntax in postgresql?

    Thanks

  2. #2
    SitePoint Wizard
    Join Date
    Jul 2003
    Location
    Kent
    Posts
    1,921
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Column position it totally irrelevant. You retrieve and insert data via a query and the order in the query is all that matters.

    you could have a table where the order the columns was created was lastname ID address firstname state teleno address
    It would have no effect on how you inserted/retrieved data, as your query controls that.

    eg select firstname, lastname, telno, state from strangetable.

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dr John View Post
    Column position it totally irrelevant. You retrieve and insert data via a query and the order in the query is all that matters.

    you could have a table where the order the columns was created was lastname ID address firstname state teleno address
    It would have no effect on how you inserted/retrieved data, as your query controls that.

    eg select firstname, lastname, telno, state from strangetable.
    Thanks, I know that the order of column is irrelevant. I just want to group similar fields together.

  4. #4
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    in mysql, you can specify the column order. i don't think it's possible in pgsql, but i'm on my way out the door and i don't have to time to check the manual for you.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •