Thursday, May 17, 2012

My note of postgresql

oracle sysdate => now()

trunc(sysdate) => date_trunc('day', now());

rownum

SELECT 
    row_number() OVER () AS i, 
    e.col1, 
    e.col2, 
    ... FROM ... 



select ... from .. LIMIT 100;

sequence_name.nextval() => nextval('sequence_name')



java -jar /path/to/schemaSpy_5.0.0.jar -t pgsql -host MYHOSTNAME -db DBNAME -s SCHEMANAME -u USERNAME -p PASSWORD -o /path/to/output/directory -dp /path/to/postgresql-9.1-902.jdbc3.jar -charset utf-8


import
=====
copy {table_name}
from '/path/to/file.csv'
DELIMITER ',' CSV;



thanks
 http://stackoverflow.com/questions/3959692/rownum-in-postgresql

No comments:

Post a Comment