How can I setup a PostgreSQL shell in VScode terminal like the Relational Database Course?

Can someone help me? Pleaseeeee

You first need to install PostgreSQL, once you do that you can do exactly like in the Relational Database Course from your computer terminal or the VSCode terminal I think. I have experience with SQL instances only in linux encironments, if you have Windows things may vary.

1 Like

I have installed it already & I use psql shell command normally in SQL shell. Anything goes well but I can’t use shell command in VScode terminal. When I try to connect to the Postgre server: psql --username=postgress --dbname=postgres. An error occured:
psql : The term ‘psql’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

I am not sure about that, I don’t think I can help

Have you tried googling it?

You need to add Postgres to your path.

  1. Search for “edit the system environment variables” .
  2. Click on environment variables at the bottom
  3. In the lower panel labelled “system variables” click on “path” then “edit”.
  4. Select new and paste in the path to the bin folder of Postgres. By default it’s C:\Program Files\PostgreSQL\14\bin
  5. Do the same for the lib folder. Default C:\Program Files\PostgreSQL\14\lib

That’s what worked for me.

1 Like

The bash, strive, cmd and shell terminal can login to psql but when codes are added to the script.sh, the response is no data found.

How to solve this problem?

You can run the script in the file terminal like in the Relational DB course ?
even adding the path of bin and lib in the system environment variables I still can’t use

Thanks it worked for me