Create a Bash script to get information about chemical elements from a periodic table database.
Project made as part of the FreeCodeCamp Relational Databases Beta Certificate course
Connected to the periodic database provided by FreeCodeCamp, fixed mistakes and added appropriate constraints and extra chemical elements information.
Created a Bash script (version controlled with git) that accepts an argument in the form of an atomic number, symbol, or name of an element and outputs some information about the given element.
View: elements.sh
- Connect to the database
periodic_tablewhich is already available. Get a little familiar with the existing tables, columns, and rows. - Read the instructions below and complete user stories to finish the project.
- There are some mistakes in the database that need to be fixed or changed. See the user stories below for what to change.
- Make a small bash program. The code needs to be version controlled with
git, so you will need to turn the suggested folder into a git repository.
- Make a script that accepts an argument in the form of an 'atomic number', 'symbol', or 'name' of an element and outputs some information about the given element.
- Rename the
weightcolumn toatomic_mass - Rename the
melting_pointcolumn tomelting_point_celsiusand theboiling_pointcolumn toboiling_point_celsius - The
melting_point_celsiusandboiling_point_celsiuscolumns should not accept null values - Add the
UNIQUEconstraint to thesymbolandnamecolumns from theelementstable - The
symbolandnamecolumns should have theNOT NULLconstraint - Set the
atomic_numbercolumn from thepropertiestable as a foreign key that references the column of the same name in theelementstable - Create a
typestable that will store the three types of elements - The
typestable should have atype_idcolumn that is an integer and the primary key - The
typestable should have atypecolumn that's aVARCHARand cannot benull. It will store the different types from thetypecolumn in thepropertiestable - Add three rows to your
typestable whose values are the three different types from thepropertiestable - The
propertiestable should have atype_idforeign key column that references thetype_idcolumn from thetypestable. It should be anINTwith theNOT NULLconstraint - Each row in your
propertiestable should have atype_idvalue that links to the correct type from thetypestable - Capitalize the first letter of all the
symbolvalues in theelementstable. Be careful to only capitalize the letter and not change any others - Remove all the trailing zeros after the decimals from each row of the
atomic_masscolumn. You may need to adjust a data type toDECIMALfor this. Be careful not to change the value - Add the element with atomic number
9to your database. Its name isFluorine, symbol isF, mass is18.998, melting point is-220, boiling point is-188.1, and it's anonmetal - Add the element with atomic number
10to your database. Its name isNeon, symbol isNe, mass is20.18, melting point is-248.6, boiling point is-246.1, and it's anonmetal - Create a
periodic_tablefolder in theprojectfolder and turn it into a git repository withgit init - Your repository should have a
mainbranch with all your commits - The
periodic_tablerepo should have at least five commits - Create an
element.shfile in your repo folder for the program I want you to make - Script (
.sh) file should have executable permissions - If you run
./element.sh, it should outputPlease provide an element as an argument.and finish running. - If you run
./element.sh 1,./element.sh H, or./element.sh Hydrogen, it should outputThe element with atomic number 1 is Hydrogen (H). It's a nonmetal, with a mass of 1.008 amu. Hydrogen has a melting point of -259.1 celsius and a boiling point of -252.9 celsius. - If you run
./element.shscript with another element as input, you should get the same output but with information associated with the given element. - If the argument input to your
element.shscript doesn't exist as anatomic_number,symbol, ornamein the database, the output should beI could not find that element in the database. - The message for the first commit in your repo should be
Initial commit - The rest of the commit messages should start with
fix:,feat:,refactor:,chore:, ortest: - You should delete the non existent element, whose
atomic_numberis1000, from the two tables - Your
propertiestable should not have atypecolumn - You should finish your project while on the main branch. Your working tree should be clean and you should not have any uncommitted changes
