PostgreSQL: The world’s most advanced open source database

Media_httpwwwpostgres_ndmht

CSV Import (Copy, Append)

COPY grace2002(
“Latitude”, “GraceDate”,”-179.5″
)

FROM ‘C:Program FilesPostgreSQL9.1data…..GRACE_1deg_2011_05.csv’

DELIMITERS ‘,’ CSV;

Update

update grace2002_agg
set “Landmark” = ‘New Dehli, India’
where
“Latitude”= 28.5
and “Longitude” = 77.5
;

CSV Export (Copy)

copy
(
select
“Latitude”, “Longitude”, ….
from grace2002_agg
where yyyy_prev = -1
)
to ‘C:Program FilesPostgreSQL9.1 …..filename.csv’
with delimiter ‘,’
csv header

String and Function operators

  • POSIX-REGEXP
    Example 1:  SELECT foo FROM regexp_split_to_table('the quick brown fox jumped over the lazy dog', E'\\\s+') AS foo;
    Example 2: --- split keyword, clean up';,.:'
    select id, trim (both ';,.:?()"' from regexp_split_to_table(lower(paper.keyword), E'\\\s+')) AS keyword from paper
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s