How create a table inside the selected database in PostgreSQL? This is the command to create a new database,

CREATE DATABASE mydb;


This is the command to create a new table,

CREATE TABLE IF NOT EXISTS mytable ( int a PRIMARY KEY );


But this does not add the mytable inside the mydb. How to add the table inside the database mydb?
But this does not add the mytable inside the mydb. How to add the table inside the database mydb?


You have to connect to the database mydb,

psql -d mydb


Then run the command