Firebase vs MySQL database (hierarchical / relational)

I am new to Firebase, I have some knowledge of databases because I worked with MySQL before, but read the benefits of Firebase and what it offers - real-time database, login (auth), analytics, etc. d.

I want to implement Firebase in a project I'm working on. Although MySQL is a relational database, through my search I found (I believe) Firebase is a hierarchical database due to the way it is structured like a JSON tree.

Following the right development path, I would like to bring ERDS tables and databases to get an idea of ​​how my project will interact with the backend. However, I'm not quite sure how I can represent the data structure using these environments, because in SQL you will have primary keys and foreign keys connecting tables. Does this also apply to Firebase?

For example, in MySQL, a table would look like this: [d]
ERD would like to:

9fG5b.png

My questions:

  • Am I saying correctly that Firebase is a hierarchical data structure?
  • How can data be presented in ERD and Database tables to show the firebase data structure?
  • Does Firebase use primary and foreign keys such as MySQL? If so, are they presented in the same way as when designing ERDs and tables for a MySQL database?
  • What is the best way to structure data in Firebase and display it in ERD and tables?

I am new to Firebase, so any help would be nice. Thanks.

+8
database mysql nosql firebase firebase-database
source share
1 answer

This is an incredibly broad topic, as evidenced by the fact that you have four questions in one post. I recommend watching our Firebase for SQL developers and reading NoSQL Data Modeling .

A few quick answers:

  • Firebase is truly a hierarchical data structure: it is really just a JSON tree in the cloud.
  • There is no specific way to display hierarchical data in an ERD. The most commonly shown JSON tree.
  • Firebase has the concept of keys, which are the names of the nodes in which data is stored. You can compare them somewhat with the primary keys of a relational database. But there is no concept of a managed foreign key.
  • as your second question: the common practice is to model your Firebase database as JSON, which is pretty convenient, as well as the format that the database stores.
+5
source share

All Articles