Web application use back end databases so to store content and information related to the web app.
Relational (SQL)
Relational (SQL) databases store their data in tables, rows, and columns.
Each table has unique keys and they link tables together and create relationships between tables.
Using relational database, it is very and quick and easy to retrieve all data about a certain element from all databases.
Some of the famous Relational databases are MySQL, MSSQL, Oracle, PostgreSQL.
Non-relational (NoSQL)
non-relational doesn’t use tables, rows, columns, primary keys, relationships, or schemas.
NoSQL stores data using various storage models depending on the type of the data stored.
Because there is no defined structure for the database, NoSQL databases are very scalable and flexible.
Some of the most common NoSQL databases include MongoDB, ElasticSearch, ApacheCassandra.
4-common storage models for NoSQL databases:
- Key-Value
- Document-Based
- Wide-Column
- Graph
Key-Value
Key-Value model usually stores data in JSON or XML.
It has a key for each pair and stores all of its data as its value.
Document-Based
Document-Based model stores data in complex JSON objects and each object has certain meta-data while storing the rest of the data similarly to the Key-Value model.
Use in Web Apps
Database has to be installed and set up on the back end server.
Let’s say there’s a PHP web app, once MySQL is up and running, we connect to the database server as such:
We create a new database with:
Connect to the new database and start using MySQL database through MySQL syntax: