alter user ruby password 'ruby_3';
q
q
\q
\q
\h
\?
\d
date
date 12
;
date;
date('');
DATE('');
to_timestamp(200120400)
to_timestamp(200120400);
to_timestamp(200120400);
;
to_timestamp(200120400);
select to_timestamp(200120400);
select date();
select to_timestamp(200120400);
select localtime;
select localtime();
select localtime;
select date;
select localtime;
select localtimestamp;
select to_timestamp(200120400);
select to_timestamp(200120400);
            select j.name,j.version,j.submitted_date,r.summary
            from journals j, releases r
            where j.version is not NULL
                  and j.action = 'new release'
                  and j.name = r.name and j.version = r.version
                  and r._pypi_hidden = FALSE
            order by submitted_date desc
;
            select j.name,j.version,j.submitted_date,r.summary
            from journals j, releases r
            where j.version is not NULL
                  and j.action = 'new release'
                  and j.name = r.name and j.version = r.version
                  and r._pypi_hidden = FALSE
            order by submitted_date desc
;
select to_timestamp(200120400);
create table a ( b timestamp );
insert into a values ('1999-01-08 04:05:06');
select * from a;
insert into a values ('1999-01-08 04:05:30');
insert into a values ('1999-01-08 04:05:40');
insert into a values ('1999-01-08 04:05:50');
select * from a ;
select * from a where b > '1999-01-07 00:00:00';
select * from a where b > '1999-01-09 00:00:00';
select * from a where b > '1999-01-08 00:00:00';
select * from a where b > '1999-01-08 04:05:30';
select * from a where b >= '1999-01-08 04:05:30';
select * from a where b >= '1999-01-08 04:05:61';
select * from a where b >= '1999-01-08 04:05:60';
select * from a where b >= '1999-01-08 04:04:60';
select * from a where b >= '1999-01-08 04:04:60 +0000';
select * from a where b >= '1999-01-08 04:04:60 +0100';
select * from a where b >= '1999-01-08 04:04:60 -0100';
select * from a where b >= '1999-01-08 04:04:60 -0200';
select * from a where b >= '1999-01-08 04:04:00 +00';
select * from a where b >= '1999-01-08 04:04:00 +0000';
select * from a where b >= '1999-01-08 04:04:00 +0100';
select * from a where b >= '1999-01-08 04:04:00 +0300';
select * from a where b >= '1999-01-08 04:04:00 -0300';
select * from a where b >= '1999-01-08 04:04:00 -3000';
select * from a where b >= '1999-01-08 04:04:00 -0300';
select * from a where b >= '1999-01-08 04:04:00 -0300';
select * from a where b >= '1999-01-08 04:04:00 -0300';
select * from a where b >= '1999-01-08 05:04:00 -0300';
select * from a where b >= '1999-01-08 05:04:00 +0300';
select * from a where b >= timestamp '1999-01-08 05:04:00 +0300';
select * from a where b >= timestamp '1999-01-08 05:04:00 -0300';
select * from a where b >= timestamp ('1999-01-08 05:04:00 -0300');
select * from a where b >= timestamp '1999-01-08 05:04:00 -0300';
CREATE TABLE messages (
    id SERIAL,
    time TIMESTAMP,
    message TEXT,
    PRIMARY KEY (id)
);
CREATE TABLE messages (
    id SERIAL,
    time TIMESTAMP,
    message TEXT,
    PRIMARY KEY (id)
);
\?
\d messages;
select * from messages order by timestamp;
select * from messages order by time;
select * from messages order by time asc;
select * from messages order by time asce;
select * from messages order by time asc;
select * from messages order by time asc limit 10;
delete from messages order by time asc limit 10;
delete from messages limit 10;
delete from messages;
delete from messages where not in ();
delete from messages where in ();
delete from messages where exists;
delete from messages where exist;
delete from messages where exists;
delete from messages;
delete from messages where id not in (select id from messages order by time asc limit 10);
insert into messages (messages, time) values ("A", 0);
insert into messages (message, time) values ("A", 0);
\d messages
insert into messages (time, message) values ("0", "A");
insert into messages (message) values ("A");
insert into messages (message) values ('A');
insert into messages (message) values ('A');
insert into messages (message) values ('A');
insert into messages (message) values ('A');
insert into messages (message) values ('A');
insert into messages (message) values ('A');
insert into messages (message) values ('A');
insert into messages (message) values ('A');
insert into messages (message) values ('A');
insert into messages (message) values ('A');
select * from messages;
delete from messages where id not in (select id from messages order by time asc limit 5);
select * from messages;
delete from messages where id not in (select id from messages order by time desc limit 5);
select * from messages;
\s cheesecake_test
