16 Apr ‘What is a database?’
Database (DB) is a program that allows you to store and process information in a structured way.
A database is a separate independent program that is not part of the programming language. You can save any information in the database so that you can later access it.
Databases are needed to store information. To get a full understanding of the need to use the database in modern web programming, you need to answer three questions:
- What information and why do we store?
- In what form and how should this information be stored?
- How and how can I access this information?
Suppose you decide to create a website where each user can keep a personal diary of weather monitoring in their city. Such a site should have at least one input form with the following fields: city, date, temperature, cloud cover, weather phenomenon, and so on.
Every day, the observer writes the weather data in this form to return to the site sometime in the future and see what the weather was like a month or even a year ago.
From this example, it follows that the programmer must somehow save the data from the form for future use. In addition to the usual viewing of the weather diary for the month in the form of a table, you can make a more complex project.
For example, to make an electronic diary something qualitatively different from its paper counterpart, it would be nice to add opportunities for a simple analysis: show which day was the coldest in November or how long the longest series of cloudy days was.
It turns out that the data must not only be stored somehow, but also be able to process and analyze them. It is for these purposes that there are databases.
How is information stored in the database
The whole storage structure is based on three concepts:
A database is a high-level concept that means combining a collection of data stored for a single purpose.
If we make a modern website, then all of its data will be stored inside one database. For the website of the online weather observation diary, you will also need to create a separate database.
Concerning the database, the table is a nested object. That is, one database can contain many tables. Tables are needed to store data of one type, for example, a list of cities, site users, or a library catalog.
A table can be represented as a regular sheet in an Excel table, that is, a collection of rows and columns. Surely everyone at least once dealt with spreadsheets (MS Excel). By filling out such a table, the user defines the columns, each of which has a heading. The lines store information. The database is exactly the same: when creating a new table, it is necessary to describe what columns it consists of and give them names.
– Mathew Marcelino