This is in continuation of My last blog about Meta Commands in PostgreSQL. In last blog I have explained what a Meta command and how to list databases. In next few blogs we will explore few of Meta commands. Lets start exploring schemas.
Visit this series of last blog for other command.
The command we will explore here is:
1. \dn
2. CREATE SCHEMA
3. SET SEARCH_PATH
Once we are able to connect to our database using \c, we can use another psql command to proceed further. To list all schemas of the database connected, we can use \dn
.
Currently there is only one schema i.e. public. This is default schema created by PostgreSQL for us. We can create new schema using CREATE SCHEMA command.
New schema is created using CREATE SCHEMA. To navigate to the desired schema in psql, we can use SET command which sets the SEARCH_PATH for our session.
This we can use psql to connect to a particual database and schema within that database.
We will explore few more commands in next blog.