Search Postgresql Archives

I have a select statement on the issue.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a select statement on the issue.
Following is the process I operate in four steps totally:
Step 1:Create Table
CREATE TABLE test
(
  code character varying(32) NOT NULL,
  name character varying(32) NOT NULL DEFAULT ''::character varying,
  qty integer NOT NULL DEFAULT 0,
  CONSTRAINT pk_test PRIMARY KEY (code)
)
Step 2:Insert Data
insert into test(code,name,qty) values('1001','1001name','qty');
insert into test(code,name,qty) values('1002','1002name','qty');
insert into test(code,name,qty) values('1003','1003name','qty');
Step 3:Select Data
select * from test
Results:
code name     qty
1001 1001name  1
1002 1002name  2
1003 1003name  3
Step 4:Update Date
update test set name='1111name' where code='1002'
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?
2. Qustion, sorting as main keys when query, how to do?
Thank you.

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux