[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.
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.
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.
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.
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!