Thread: Query from shell
Hi every body, somebody can show me hot to execute a query from a shell thanks in advanced!!!
Judith wrote: > Hi every body, somebody can show me hot to execute a > query from a shell echo QUERY HERE | psql databasename Or, if you want to run several queries, run psql and run your queries there.
Owen Jacobson wrote: > Judith wrote: > > >> Hi every body, somebody can show me hot to execute a >>query from a shell > > > echo QUERY HERE | psql databasename > > Or, if you want to run several queries, run psql and run your queries there. > or psql -d <dbname> -c "your query here"
On Thursday 06 April 2006 02:37 pm, Judith saith: > Hi every body, somebody can show me hot to execute a query from a > shell > > thanks in advanced!!! > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org Do this: psql -c 'SELECT code FROM cust' rnd;
On Thursday 06 April 2006 15:37, Owen Jacobson wrote: > Judith wrote: > > Hi every body, somebody can show me hot to execute a > > query from a shell > > echo QUERY HERE | psql databasename > > Or, if you want to run several queries, run psql and run your queries > there. > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster I think you can also run: psql -f filename.sql database_name
or psql db <<EOQ select...; delete...; update...; \q EOQ ---------- Original Message ----------- From: "Owen Jacobson" <ojacobson@osl.com> To: <pgsql-sql@postgresql.org> Sent: Thu, 6 Apr 2006 14:37:51 -0700 Subject: Re: [SQL] Query from shell > Judith wrote: > > > Hi every body, somebody can show me hot to execute a > > query from a shell > > echo QUERY HERE | psql databasename > > Or, if you want to run several queries, run psql and run your queries there. > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster ------- End of Original Message -------