Hi,
On Mittwoch, 28. November 2007, gongzhixiao@gmail.com wrote:
| Step 4:Update Date
| update test set name='1111name' where code='1002'
Simplified, when you perform an update, PostgreSQL internally marks
the affected row as deleted and inserts a new row in the table. For details
look at the MVCC documentation, eg.
http://www.postgresql.org/docs/8.2/interactive/mvcc-intro.html
| Results:
| code name qty
| 1001 1001name 1
| 1003 1003name 3
| 1002 1111name 2
|
| Question:
| 1. Why the default output changes after I execute the update statement?
See above; output order is not guaranteed without order clause.
| 2. Qustion, sorting as main keys when query, how to do?
You mean: select * from test order by code ?
Ciao,
Thomas
--
Thomas Pundt <thomas.pundt@rp-online.de> ---- http://rp-online.de/ ----