DEV Community

Thomas Cansino
Thomas Cansino

Posted on

[DAY 96-98] I built a script that gets info from a periodic table database

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 96-98, I learned Git and built a periodic table database. 
Image description

I followed through the freecodecamp database course to learn Git. It taught me about making branches to add a feature or fix a bug and merging those branches to the main one to have a good system for version control. This was a good course because Git is used when building projects with a team.
Image description

The next thing I did was a project where I built a periodic table database. This is part 4 out of 5 projects needed to complete to get the database certificate from freecodecamp.
Image description

What I did first is to make a database with 3 tables: elements, properties, and types.

After that, I assigned primary keys for each table:

  • atomic_number for elements and properties table
  • type_id for types table

I also linked the tables with foreign keys:

  • atomic_number to link elements and properties table
  • type_id to link properties and types table

Lastly, I created a bash script that gets information about the chemical elements from the periodic table database. 
Image description
Image description

Example: 

Type in ./element.sh on the terminal.

Next, let’s say I wanna get information about Fluorine. So type in ./element.sh fluorine.

Finally, the terminal will output: 

The element with atomic number 9 is Fluorine (F). It's a nonmetal, with a mass of 18.998 amu. Fluorine has a melting point of -220 celsius and a boiling point of -188.1 celsius.

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

Top comments (0)