Learn Linux, PostgreSQL, Git, and Bash Scripting – right from the command line (new 300-hour freeCodeCamp Certification)

I’ve been enjoying this so far. I’ve completed Mario database and almost done with Students database.
Initially, I got it to load pretty easily. Restarting it up was a challenge but I got it going again.

I’ve also submitted a PR to fix one of the student challenges.

1 Like

@moT01 regarding ID: 2200

Lets do some more experiments with joins. 
Say you wanted to find a list of majors that students are taking.
Use the most efficient JOIN to only get rows from the tables you need to find that.

I found this challenge ambiguous in requesting a “list of majors” yet expecting the output to include all columns from the join.

My interpretation was to only list the column of “majors” after the join operation.

Should this text be updated or should the challenge be updated?

EDIT: seems this is part of the following challenge 2210. I recommend updating the text in 2200.

regarding ID: 2210

would you consider identifying (tablename).(column) is more concise than only identifying (column) when working with joining tables?

Thanks for the feedback @jeremyfiel. There’s definitely some bugs and issues that can cause people to get stuck that need to be worked out - so it’s good to hear that you have been able to get through them fairly smoothly thus far. I left a comment on your PR for how to contribute to these.

I found this challenge ambiguous…

Yes, that one could use some clarity I think. Perhaps if we changed it to “Start by using the most efficient join…”

would you consider identifying (tablename).(column) is more concise than only identifying (column) when working with joining tables?

I’m not sure exactly what you mean there. It doesn’t seem more concise as it’s longer. Perhaps not as clear, though. You should only need to use the table name if the column shares a name with a column on a table you are joining.

I’m not a SQL expert by any means but in the past I’ve found some queries do not return the expected columns or an error occurs when joining tables if the tablename.column is not identified properly in the SELECT statement. I think it derives from using columns on the joined (right) table rather than the “left” table where a column naming collision may occur.
e.g.
SELECT major FROM students INNER JOIN majors ON…
vs
SELECT majors.major FROM students INNER JOIN majors ON…

this articulates it quite well How to join duplicate column name in joins in SQL Server? - Stack Overflow

I’m no expert either.

I think it derives from using columns on the joined (right) table rather than the “left” table where a column naming collision may occur.

I will have to give that a test. I don’t think it matters if it’s the left or right table. Like I said, I believe a problem only occurs when there’s a column in both tables that share a name. Just gave it a test, and that appears to be the case - so only using major should work. It gave you an error?

it didn’t give an error but based on prev exp i used the tablename.column convention and it wasn’t passing. after checking the hints, it worked.

Ahh, yes - there’s likely more than a few tests that won’t allow valid syntax. I certainly tried to allow as many variations as I could. Very difficult since there’s an infinite amount. That particular syntax is probably one of the most common, though.

regarding 2230:

solution is showing the wrong expected output.

The challenge indicates creating a list of majors NOT taken by students, but the solution shows a full list of students with their majors joined and also includes the two majors not taken by any student.
I was only able to get the results by using a WHERE clause but the directions don’t allow it.

Hello. I try to finish Mario database tutorial but at some point( 36% first, 40something % after restart of tutorial) connection to db drops; like whatever command I type in terminal it has no feedback. I close VScode then restart it. I enter psql --username=freecodecamp dbname=postgres command to connect to db but no success. Container in docker is active.

I’m stuck when installing and configuring nvm. RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash failed. I think that’s a common problem for most Chinese users. @moT01

Thanks for reporting @miyaliu

Someone in chat had a similar issue and posted this error message - posting here for reference:

`=> ERROR [11/13] RUN . "/home/codeally/.nvm/nvm.sh" && nvm install 14 && 0.4s
------
> [11/13] RUN . "/home/codeally/.nvm/nvm.sh" && nvm install 14 && . "/home/codeally/.nvm/nvm.sh" && nvm use v14 && . "/home/codeally/.nvm/nvm.sh" && nvm alias default v14:
#14 0.301 bash: cannot set terminal process group (-1): Inappropriate ioctl for device
#14 0.301 bash: no job control in this shell
#14 0.347 bash: /home/codeally/.nvm/nvm.sh: No such file or directory
------
executor failed running [/bin/bash --login -i -c . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION} && . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION} && . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}]: exit code: 1
[5655 ms] Command failed: docker build -f /Users/p0a0221/Desktop/freeCodeCamp/rdb-alpha/Dockerfile -t vsc-rdb-alpha-7c2092dbe2400e3ba89bf7d658f93503 /Users/p0a0221/Desktop/freeCodeCamp/rdb-alpha`

Both issues seem to be related with nvm - not sure if they’re the same. Does your error look like this @miyaliu?

Yes, same error.

I made some changes here:

# Install and configure nvm
# RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

# RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION} && \
#  . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION} && \
#  . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}

# ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
RUN sudo apt-get install -y nodejs
RUN sudo apt-get install -y npm

I tried several times, and I remember it showed I didn’t have access to a certain repo (I forgot to save a screenshot). Then I removed the containers and images, and repeated the guiding steps - it suddenly worked.

I can work on the challenges, and run the test.

But, when I restart the projects, and run Remote-Containers: Rebuild and Reopen in Container, it shows:
image

It looks like I have to remove the containers and images, and repeat the steps.

I tried all these with and without VPN. Fortunately, it seems it can work without VPN.

With not having much contact with bash scripting before, and some basic knowledge about databases, I’ve started these few day ago and arrived now at Learn SQL by Building a Student Database. I found it ridiculously fun, especially the first half.

2 Likes

Hey @miyaliu - can you clarify this a little for me:

“I tried all these with and without VPN. Fortunately, it seems it can work without VPN.”

Did adding your additions and following your steps work both with and without using a VPN?
And before you made these changes it didn’t work - you tried with and without VPN, and it didn’t work either way?

Yes, that’s right. Adding those two lines and then running Remote-Containers: Rebuild and Reopen in Container… worked both with and without using a VPN.

1 Like


Currently I’m at the step CodeRoad: Start but it is launching forever @moT01

Hi all!

Thanks for releasing this wonderful course. I am having a great time going through it now.

Just a feedback regarding Building a student database 2.

There are some excercises where the instruction are a bit missleading. For example, take this excercise:

You’re doing great. Next, use the most efficient join to get the rows needed if you were asked to get the first name, last name, major, and GPA of students who are taking Data Science or have a gpa of 3.8 or greater.

Reading this, I would think that I need to SELECT only the fours requested rows (first name, last name, major and GPA), join both tables and then include conditions to complete the excercise. However, this doesn’t resolve the exercise at all. After reading the hints, you realize that you need to query all columns (*) and don’t include any conditions (avoid using WHERE and HAVING) for now.

This happens with a couple more excercises.

I believe the wording should be amended slightly to indicate the expected result. For example:

You’re doing great. Next, use the most efficient join to get the rows needed if you were asked to get the first name, last name, major, and GPA of students who are taking Data Science or have a gpa of 3.8 or greater. Start by selecting all columns from both tables. Don’t include any conditions for now.

Just my 2 cents.

Cheers.

1 Like

Anorther comment regarding student database 2.

In the last excercise, we are asked to:

List of courses, in alphabetical order, with only one student enrolled:

The correct answer given in hints is the following:

SELECT course FROM students RIGHT JOIN majors USING(major_id) INNER JOIN majors_courses USING(major_id) INNER JOIN courses USING(course_id) GROUP BY course HAVING COUNT(course) = 1 ORDER BY course;

Which gives the following result:

Network Security
Server Administration
UNIX

However, I don’t believe this is correct. Server Administration and UNIX are correct, but Network Security is not. Network Security is only in one major, Network Engineering, and no students are taking this major.

In addition to this, Computer Systems and Computer Network courses are both in 3 majors: Computer Programming, Network Engineering and System Administration. Computer Programming and Network Engineering have no students, and System Administration has 1 student. Therefore, there should be part of the correct answer.

My proposed correct answer is:

Computer Systems
Computer Network
Server Administration
UNIX

To obtain this answer, my proposed solution is:

SELECT course FROM students INNER JOIN majors_courses USING(major_id) INNER JOIN courses USING(course_id) GROUP BY course HAVING COUNT(student_id) = 1 ORDER BY course;

Cheers!

would you mind opening an issue on GitHub with your feedback? On the github.com/freecodecamp/freecodecamp repo it’s perfect

1 Like