![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
When I do a "SELECT * FROM myTable WHERE ..." using psql I want to have the columns displayed in a meaningful order by default. I want to avoid a "SELECT firstname, lastname, <many other cols to follow> ...". Is it possible to modify the order of columns with an ALTER TABLE myTable ALTER COLUMN lastname <put behind firstname Same holds for adding a new column, how can I ALTER TABLE myTable ADD COLUMN title VARCHAR(255) <put before firstname This is possible in mySQL, not in PostgreSQL? Any ideas are welcome - Michael |
#3
| |||
| |||
|
|
When I do a "SELECT * FROM myTable WHERE ..." using psql I want to have the columns displayed in a meaningful order by default. I want to avoid a "SELECT firstname, lastname, <many other cols to follow> ...". Is it possible to modify the order of columns with an ALTER TABLE myTable ALTER COLUMN lastname <put behind firstname Same holds for adding a new column, how can I ALTER TABLE myTable ADD COLUMN title VARCHAR(255) <put before firstname This is possible in mySQL, not in PostgreSQL? |
|
Any ideas are welcome - Michael |
#4
| |||
| |||
|
|
IMHO it is generally a bad idea to rely on column order because that may change etc. It's usually best to explicitly select columns in the order that you desire. |
![]() |
| Thread Tools | |
| Display Modes | |
| |