Databases are logical structures that can store and organized any kind of data for future use. They are an indispensable component of a web application, thus they allow us to process, retrieve, or evaluate our data. They are managed by an application called DBMS (Database Management System), which organizes data according to specific patterns (database models). The relational model is perhaps considered to be the default paradigm, organizing data into cross-referenced tables, rows, and columns.
Databases have two ways to store data:
Data persistence: since the data is store on disk, even if the application or computer shuts down and restart, everything will continue there.
Ephemeral storage: the data is saved in-memory, but it is volatile, meaning that it does not survive a system shut down. Although the data might not be saved, in-memory databases are usually faster.
Now that we now how data is store, how can we interact with it? Databases provide an interface for users or applications, that allow us to access and interact with what's stored there. There are four types:
Data definition: allow us to create, modify, and remove definition's of the data structure.
Update: allow us to insert, modify, and delete data within the database.
Retrieval: allow us to access the stored data. It can be access as-is, or it can be filtered for a specific result.
Administration: these tasks are not directly related to our data, but it is important for user management, security, and performance monitoring.
Creating, modifying, or deleting data are potentially dangerous operations, often known as "write operations". On the other hand, retrieving data allow users to access that information for certain use, without modifying or interfering with the database itself.
In the case that we don't want to use a database, there are a few options that, in some way, are also consider a database:
- Local memory or temporary filesystems
- Serialize application data directly to the local filesystem
- Storing file-like objects directly to disk
Database are used for many reasons, some of them are:
Storing and processing site data, which affects how information is organized on the site. If we have an e-Commerce, our database can store user information, product availability, and orders history.
Analyzing information to make better decisions, which relates to the basic functionality of the website. This operations, called analytics, provide answers to specific questions such as product trends, states where we ship the most, and factors that influence sales.
Top comments (0)