SQL

create table x ( a timestamp(6));
insert into x values ( current_timestamp );
select * from x;

SELECT * FROM x ORDER BY a asc

SELECT * FROM x ORDER BY a desc

Αυτόματη προετοιμασία και ενημέρωση για TIMESTAMP και DATETIME.


CREATE TABLE MyTest (myKey int PRIMARY KEY, myValue int, TS timestamp)
INSERT INTO MyTest (myKey, myValue) VALUES (1, 0)
INSERT INTO MyTest (mykey, myValue) VALUES (2, 0)
SELECT * FROM EMP AS OF TIMESTAMP TO_TIMESTAMP(’26-JUN-09 16.55.40′,’DD-MON-YY HH24-MI-SS’)
———————
CREATE TABLE MyTest3 (x timestamp(6))
INSERT INTO MyTest2  VALUES (current_timestamp)
select * from  MyTest2
select * from  MyTest2  order by x asc
select * from  MyTest2  order by x desc
——————–
CREATE TABLE MyTest4 (a int,x timestamp(6))
INSERT INTO MyTest4  VALUES (5,current_timestamp)
select * from  MyTest4
select * from  MyTest4  order by x asc
select * from  MyTest4  order by x desc