This section clarifies different techniques for getting to the information base. Expect that we have just made an information base in our past section. You can choose the data set utilizing both of the accompanying techniques −
- Information base SQL Prompt
- Operating system Command Prompt
Database SQL Prompt
Expect you have just dispatched your PostgreSQL customer and you have arrived at the accompanying SQL brief −
postgres=#
You can check the accessible data set rundown utilizing \l, i.e., oblique punctuation line el order as follows −
postgres-# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+---------+-------+-----------------------
postgres | postgres | UTF8 | C | C |
template0 | postgres | UTF8 | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
testdb | postgres | UTF8 | C | C |
(4 rows)
postgres-#
Presently, type the accompanying order to interface/select an ideal data set; here, we will associate with the testdb data set.
postgres=# \c testdb;
psql (9.2.4)
Type "help" for help.
You are now connected to database "testdb" as user "postgres".
testdb=#
OS Command Prompt
You can choose your data set from the order brief itself when you login to your data set. Following is a straightforward model −
psql -h localhost -p 5432 -U postgress testdb
Password for user postgress: ****
psql (9.2.4)
Type "help" for help.
You are now connected to database "testdb" as user "postgres".
testdb=#
You are currently signed into PostgreSQL testdb and prepared to execute your orders inside testdb. To exit from the data set, you can utilize the order \q.