Skip to content

Instantly share code, notes, and snippets.

@lin
Last active January 25, 2017 11:57
Show Gist options
  • Save lin/90b3e4d15e4060790ac71381c96f2296 to your computer and use it in GitHub Desktop.
Save lin/90b3e4d15e4060790ac71381c96f2296 to your computer and use it in GitHub Desktop.
Postgresql

one: how to assign different priorities. two:

===========

1, createdb
2, dropdb
3, psql \h (help) \q (quit)
CREATE TABLE weather ();
DROP TABLE weather;
INSERT INTO weather VALUES ();
INSERT INTO weather () VALUES ();
SELECT * FROM weather;
SELECT city, temp_lo, temp_hi, prcp, date FROM weather;
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;
SELECT DISTINCT city FROM weather;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment