From a Linux command prompt (e.g., Linux terminal) you want to connect to a specific Postgres database. How do you create a table or issue SQL commands to a specific Postgres database from the back-end (the Postgres server itself)?
1. First enter the Postgres command prompt by running these two commands:
sudo -i -u postgres
2. Assuming the database's name is cooldb, run this command:
3. Run your SQL commands. For example:
create table veryneat(id int, name varchar(40));
insert into veryneat values(1, 'words');