6/17/2023 0 Comments List user postgres![]() ![]() I think DO generated this for me, or maybe PostgreSQL. # -d is the name of the database to connect to. # -p is the port where the database listens to connections. ![]() # -U is the username (it will appear in the \l command) # -h is the name of the machine where the server is running. This worked to connect to Postgres on DigitalOcean On Windows it might look like C:\Program Files\PostgreSQL> but Windows prompts are also configurable. Prompts are configurable so it may well not look like this. The $ starting a command line in the examples below represents your operating system prompt. The user name and password for your PostgreSQL databaseĬommand-line prompts on the operating system.Inserting several records at once (INSERT INTO)Īdding only specific fields from a recordĭoing a simple query–get a list of records (SELECT) \d and \d Display columns (field names) of a table Starting and quitting the psql interactive terminal It covers the most common operations and shows them roughly in sequence,Īs you’d use them in a typical work session. This section isn’t a full cheat sheet for psql. ![]() Knowing how to perform these operations on the command line means you can script them,Īnd scripting means you can automate tests, check errors, and do data entry on the command line. You can do some of them through a visual user interface, but that’s not covered here. Many administrative tasks can or should be done on your local machine,Įven though if database lives on the cloud. You can follow through the examples and the output is shown as if youĭid type everything out. If you don’t have access to a live PostgreSQL installation at the moment we still have your back.
0 Comments
Leave a Reply. |