DEV Community

Thomas Cansino
Thomas Cansino

Posted on

[DAY 84-86] I Learned PostgreSQL & Bash Scripting

Hi everyone! Welcome back to another blog where I document the things I learn in web development. I do this because it helps retain the information and concepts through active recall.

On days 84-86, I finished building the database consisting of celestial bodies with PostgreSQL.
Image description

Last blog, I talked about how I started building the database and how it was not done yet, part of it is because I was still having trouble referencing foreign keys to other tables due to lack of understanding.

In this blog, I was able to understand the concept of primary and foreign keys in databases and how tables link to each other using it.

What I did was to make 4 tables: galaxy, stars, planets, and moon.

After that, I added the necessary columns to satisfy the user stories in order to complete the project.

I also set the primary keys for each table:

  • galaxy_id for galaxies table
  • star_id for stars table
  • planet_id for planets table
  • moon_id for moon table

As well as linking all of the tables with their foreign keys:

  • galaxy_id for stars table
  • star_id for planets table
  • planet_id for moon table

The way foreign key works is that it links tables and groups each row. For example, we look at the stars table, every row consists of every star. For every star, it has a corresponding galaxy_id, the value of it is the ID of the galaxy where that star belongs.

The same goes for the planets where each planet belongs to a certain star and for the moons where each moon belongs to a certain planet.

With that, I have completed 1 out of 5 projects in the relational database course in freecodecamp.
Image description

Afterwards, I continued on with the course and finished building 5 programs to learn bash scripting.

I made a registration form to log your name, location, and your favorite coding website.

Then, a countdown to direct you to a bingo game where it generates random numbers from 0 to 75 and functions like a bingo.

Next is a magic 8-ball where you ask questions and it will randomly get an answer from an array.
Image description

The last program is used to run the other 4 programs I mentioned above so that it will start from the registration form and end on the magic 8-ball.

With that, I completed one of the topics in the course and moved on to the next one where I build a student database to learn SQL by creating a bash script that uses SQL to enter information about CS students into Postgres.
Image description

This part is not done yet and I aim to finish it by the next blog…

Anyways, that’s all for now. More updates in my next blog! See you there!

Top comments (5)

Collapse
 
ax17 profile image
Alex

I find it very inspiring. I am learning a lot but gave up on my passion writing as I cannot find resources for also writing about what I learnt . I barely have time for assimilating and practicing. What is toursecret how can you do it all?

Collapse
 
thomascansino profile image
Thomas Cansino

Hey Alex, I suggest to take it slow and focus on the things that need most priority. If you want to write about your journey, you must have a journey in the first place, so focus on learning first and just write on your free time. Set aside an hour every week to write a simple blog about your journey and expand from there... Hope I helped! Goodluck on your journey! I believe in you!

Collapse
 
ax17 profile image
Alex

Thank you! Indeed you re right

Collapse
 
practicaldev2024 profile image
Inzamam Baig

That's amazing that you're learning new stuff. However, I'd recommend you to build real world projects. Most tutorials don't match up with problems that devs face in an project.

Collapse
 
thomascansino profile image
Thomas Cansino

I agree. Real world projects is where true learning comes. I'll start building them after going through the courses since it's all I can manage with my time right now (I work a 9-5 and only learn 2 hours every day). I'm not in any rush though...However, I would love if you can share project ideas for me to build in the future!