SQL vs NoSQL
I haven’t really written too much about programming on the backend, mostly because I prefer frontend programming. Recently I’ve started working on my mobile app Plantbae again and I am working on adding more features and then deploying it to the app for everyone to use. When I first started working on the app as my final project, I was in a position where I didn’t have to consider whether my app was scaleable. In bootcamp I was taught Ruby followed by Ruby on Rails and although I really enjoyed Rails and it made a lot of things easier but I wanted to try a newer technology for my backend. I can’t pinpoint exactly what led me to Firebase but knowing that it was created by Google I figured it was something to look into. After watching a few YouTube videos, reading a couple of docs and looking through Twitter hashtags to hear what real SWE’s were saying, I decided to use it. Scalability is something often heard in programming and now that I’m working on putting my app out to the public, it’s something I have to consider. Firebase is a NoSQL database, it was easy to set up and get started. But what’s the different between traditional SQL & NoSQL databases?
SQL:
- Stands for Structured Query Language, a strict and structured way of sorting data.
- Consists of two or more tables with columns and rows. Each row represents an entry, and each column represents specific information like a name or address etc.
- Relational databases, tables can have a few relationship types such as One to One, One to Many and Many to Many. These relationships between field types is called a schema.
- Data is stored across multiple tables, which are then connected through relationships. This allows developers to retrieve and connect data even if the data is distributed across multiple tables.
- In relational databases, the schema must be explicitly defined before any information can be added.
- Horizontal scaling is difficult, vertical scaling is possible. Horizontal scaling adds more servers for stronger computing power. Vertical scaling increases server capacity but this has limits.
- SQL database are MySQL which is the most popular open-source database. Oracle, an object-relational DBMS written in C++. Microsoft Azure, a cloud computing platform that supports any OS and lets you store,compute and scale data in one place. There’s also several more SQL databases.
NoSQL:
- Much more flexible than traditional structured databases.
- Data is stored in collections which is similar to tables.
- Within the collections are documents which is similar to rows.
- No schema.
- No relationships.
- Can scale horizontally & vertically.
- Great performance for large read & write requests.
Through my limited experience with both types of databases, I’m not sure that one is better than the other. I think the application, and the functionality of it is the main deciding factor on which is the best to use. I believe both technologies have pros and cons, I even heard of companies using both to hold different types of data. I am personally a big fan of NoSQL and really enjoyed implementing it with my React Native frontend. I’ve only used Firebase so as I am working on releasing my app, I can get more exposure into all the great things I can do with it. Happy coding !