How to access the database in PostgreSQL

We can access the database using psql db_name. By default, we connect to postgres database.

If we want to change the current database from psql shell, use \connect database_name

k2schools-# \connect postgres
WARNING: Console code page (437) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page “Notes for Windows users” for details.
You are now connected to database “postgres” as user “postgres”.
postgres-#

How to get PostgreSQL version:

SELECT version();

How to access the database in PostgreSQL

How to get current date in PostgreSQL

SELECT current_date;

How to access the database in PostgreSQL1

How to quit from PostgreSQL shell:

Type \q. Then, press any key to quit from psql shell.

How to access the database in PostgreSQL2

Please visit for PostgreSQL basics

CheapSexCams
Responses are currently closed, but you can trackback from your own site.

Comments are closed.

Powered by k2schools
%d bloggers like this: