introductions to postgresql

Download Introductions to Postgresql

If you can't read please download the document

Upload: -

Post on 28-Jul-2015

101 views

Category:

Software


1 download

TRANSCRIPT

1. PostgreSQL 2. ) with( ... ) ... ( ORDBMS CREATETABLEcities(nametext,populationreal,altitudeint); CREATETABLEcapitals(statechar(2))INHERITS(cities); 3. CREATEORREPLACEFUNCTIONget_cities() RETURNScitiesAS 'select*fromcities;' ALTERFUNCTIONget_cities()OWNERTOpostgres; selectrow_to_json(get_cities()); Createtypestateas(state_codeint,state_namevarchar(10)); CREATETABLEcapitals1(statestate)INHERITS(cities); insertintocapitals1values('mashhad',300,1,(1,'KH')); 4. With statement WITHRECURSIVEt(n)AS( VALUES(1) UNIONALL SELECTn+1FROMtWHEREn