Learn SQL by Building a Student Database: Part 1 - Build a Student Database: Part 1

Tell us what’s happening:
I am doing revision for this course in my own visual studio code for my own personal data.

When I add in the tuples-only-c line code and also the code after the get major ID comment in the insert_data.sh, the response is need user password and cannot proceed.

Even after I skipped using the tuples-only-c code and run the script with


the response is $ ./insert_data.sh
./insert_data.sh: line 7: SELECT major_id FROM majors WHERE major=‘major’: command not found

May I know how to resolve this issue?

Your code so far

# Script to insert data from courses.csv and students.csv into students database
PSQL="psql -X --username=freecodecamp --dbname=students --no-align --tuples-only -c"
cat courses_test.csv | while IFS="," read MAJOR COURSE
  # get major_id
  MAJOR_ID=$($PSQL "SELECT major_id FROM majors WHERE major='$MAJOR'")
  echo $MAJOR_ID 

  # if not found
  if [[ -z $MAJOR_ID ]]
  # insert major

  # get new major_id


  # get course_id

  # if not found

  # insert course

  # get new course_id

  # insert into majors_courses


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36 OPR/

Challenge: Learn SQL by Building a Student Database: Part 1 - Build a Student Database: Part 1

Link to the challenge:

Maybe you can either provide the password as an argument or configure PostgreSQL to allow passwordless authentication for the specified user.

PSQL=“psql -X --username=freecodecamp --dbname=students --no-align --tuples-only -c”

export PGPASSWORD=‘your_password’
However, keep in mind that including passwords in plain text can be a security risk

I know the problem already. I need to have a laptop that I can download all the necessary related programs. Otherwise, the code that is function normally for the test here is not usable in the Visual Studio Code Program.