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.