Skip to content

Instantly share code, notes, and snippets.

@haikyuu
Created December 8, 2016 12:51
Show Gist options
  • Save haikyuu/48d4370dc794ca86bcaa05f6dee43a17 to your computer and use it in GitHub Desktop.
Save haikyuu/48d4370dc794ca86bcaa05f6dee43a17 to your computer and use it in GitHub Desktop.
Postgres
A cluster is a group of databases runing on the same server;
- `COPY tablename FROM '/home/user/weather.txt'` *inserts* rows from the given file to `tablename`; [Copy](http://devdocs.io/postgresql~9.6/sql-copy)
@haikyuu
Copy link
Author

haikyuu commented Dec 8, 2016

A cluster is a group of databases runing on the same server;

  • COPY tablename FROM '/home/user/weather.txt' inserts rows from the given file to tablename; Copy

@haikyuu
Copy link
Author

haikyuu commented Dec 8, 2016

Requests:

  • SELECT city, (temp_hi+temp_lo)/2 AS temp_avg, date FROM weather;
  • SELECT * FROM weather WHERE city = 'San Francisco' AND prcp > 0.0;
  • SELECT * FROM weather ORDER BY city, temp_lo;
  • SELECT DISTINCT city FROM weather ORDER BY city;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment