Script is disabled
Select Page

Firebase Database CRUD


Fresh from graduating from college, I only knew two types of database, MySQL, and MS Access but when I started working, I heard a database that I don’t know how to use, and it is called Firebase.

Firebase is a hierarchical database, unlike MySQL that is a relational database. Hierarchical means that the form of saving data is in JSON tree. Before I always use MySQL as the database for the websites or apps I am making, so for me to learn new concept much easier, I compared the two database approaches.

Comparative approach to learning Firebase applied to the websites

In Firebase, when you create a project, the creation of database will be included in it, the project id will be the name of the database, and in MySQL, you are the one who will give the name to the database specifically.




After creating the database, you need to connect this to your website. In Firebase approach, the usual server is in JavaScript unlike MySQL; it often uses PHP as a server. To add Firebase database to your codes, you need to configure it first, as if you are selecting database in MySQL, the code “mysqli_connect(server, username,password,database_name)”. You can find the SDK configuration in // and click on the “Add Firebase to your web app” then paste it into your code.

If you want to retrieve data, you need to use the code, “database.ref(node_directory)” just like the code “Select * from table_name” in MySQL. The node directory is the words after in your URL. The good thing about Firebase is it can transmit new data concurrently while the application is running. These codes are called “child_changed” which will be loaded when there is an update on the indicated node directory and “child_added” which will be loaded when the new node has been added on the pointed node directory.




Inserting data in Firebase is “database.ref(node_directory).set({node_name : value})” while in MySQL, it is “Insert into table_name (field_name) values (value)” .

When you need to update data in Firebase, the code “database.ref().update({node_name : value})” is used similarly to the code in MySQL, “Update
set field_name=value where field_name=value”.

Lastly, Firebase uses the code “database.ref(node_directory).remove()” in order for the data to be deleted, which is the same as the code used in MySQL, “Delete from table_name where field_name=value”.
The update and delete in Firebase doesn’t need the where clause because the node directory must be correctly pointed to the location of the node to be updated or deleted.

Send us your questions on Firebase

13 + 15 =

Related Blog Post

The Adventures in WordPress Multisite

What is Multisite? What is the use of Multisite? Many other people don’t know what the purpose of multisite and its advantages are. Wordpress has so many features that can help all people in many aspects and one of the highlights is Multisite. Multisite is one of the...