• 8 hours
  • Medium

Free online content available in this course.

course.header.alt.is_video

course.header.alt.is_certifying

Got it!

Last updated on 5/5/22

Understand the Purpose of a Database

Link Your Database to Your Application

What is a database used for?

As the name suggests, a database is designed to store data.

Humans don't interact directly with databases, but computer programs do. Mobile apps, software applications, and websites are all types of computer programs.

But what is data?

Well, it could be anything! Here are some examples:

  • The Wikipedia website gives you access to an encyclopedia of data.

  • The Instagram mobile app stores data as photos. 

  • Your email software accesses data relating to your email messages. 

A database and a computer program (app, website, etc.) are complementary (i.e., you can't have one without the other). If you close a computer program not linked to a database, the program won't remember anything. 

That's why it needs to work with a database, which acts as a sort of memory.

Picture this:

  • A computer program is like a cloth factory.
    A program is a chain of lines of code, which is like the machines in the factory. 

  • A database is like a warehouse containing the raw materials (cotton, silk, etc.) that the machines will process.  

  • The raw material is the data used by the computer program. 

A factory without any raw materials is pretty useless!

You can see the interdependence of the database and the program using Wikipedia as an example. The name Wikipedia has two elements:

  • "Wiki” is a computer program that displays text on a web page.

  • “Pedia” refers to a set of encyclopedic documents. 

But if you remove the encyclopedic database and link a Wiki with a database containing dictionary definitions, you’ll end up with Wiktionary.

This site looks almost exactly like Wikipedia because what you see on the screen is controlled by Wiki, but the data is different. There are many other examples: Wikinews, Wikiversity, Wikileaks, etc.

Understand the Database Management System (DBMS)

What does a database stored on a computer look like?

Usually, a database consists of one or several files in which all the data is stored.

A bit like a text file or a spreadsheet?

Exactly! Some programs create their own files to store their data. To get an idea, look in the  C:\Users\<username>\AppData  folder in Windows (you may need to show hidden items to see this), the  ~/Library/Application Support/  folder in macOS, or the  ~/.cache  folder in Linux.

For example, if numerous applications need to share data, they need to “agree” on how to format it in the files.

This is often the case in business systems, where different software packages use data. For example, the accounting department's software could use product sales data. Or there might be some software that creates client data reports in the form of graphs, which could be helpful to the marketing department. However, if each software package reads and writes the data differently within the same files, things could get messy!

Also, the more data you have, the longer it takes to access or update it. You need to be able to find the exact location of the data you require within one or many huge files.

Many optimization methods can help reduce the processing time, such as creating an index

In the same way, a book index can tell you which page has the chapter you're looking for; a database index indicates the exact location of a data item in the computer memory.

However, there is an art to using all of these optimization methods, and it's pretty complicated. In addition, when a developer writes a program, they don’t always want – or have the skills – to build optimization into their code.

That's where a DBMS comes into play. A database management system (DBMS) is a program that interfaces between the program and the data.  

Every DBMS has its own language, enabling it to communicate with the applications that need to access the data. The most common language is SQL. We won’t be using it in this course because we only cover database modeling, but you will probably use it later once you have created your database.

Understand the Attributes of a DBMS

Going back to the cloth factory analogy, you could see the DBMS as a service provider that manages the raw materials warehouse. The cloth factory sends orders using a particular language: “Please provide 8 lbs of cotton.”

The service provider manages the warehouse, organizing the warehouse shelving, inventory, movement of goods within the warehouse, etc.

Another factory could also use the same service provider and language: “Please provide 10 lbs of silk.”

So, the DBMS specializes in storing, accessing, and writing data. As you will see, managing data is a job in itself! Because of this, programs and applications that use a DBMS don't need to worry about:

  • Optimizing access to the data (in terms of access time).

  • Optimizing data storage (reorganizing, segmenting, etc.).

  • Data administration (storage format, generating stats on data volumes, etc.).

  • Sharing the data (with other programs or humans).

  • Checking data for consistency.

  • Ensuring data security (authentication, access rights, etc.).

  • Ensuring data resilience (backups in the event of outages).

So, as you can see, this is a great time saver for developers when writing their programs.

To finish off, let’s talk about a very well-known DBMS: SQLite. We’ll use it later on in the course. It’s straightforward, so it's perfect for beginners.

If you’ve been digging your computer folders, you’ve probably come across files with the  .db  ,  .db3  ,  .sqlite  , or  .sqlite3  extension. All of these files are created and accessed by SQLite. You’ll know that it’s a database with data inside whenever you see one.

These files were created following a request from a computer program, which has asked SQLite to store the data it needs. When the program needs to access it, it asks SQLite to do it. Therefore, SQLite is playing the role of an intermediary.

Let’s Recap!

  • The purpose of a database is to store data, so it is accessible by one or more programs or applications.

  • A DBMS is a program that acts as an intermediary between the program or application and data, using a predefined language such as SQL.

  • A DBMS specializes in storing data and optimizing read and write access.

Now that you know what a database and DBMS are, we need to detail the different forms that data can take. This will enable us to choose the type of database to hold our filming locations data.

Ever considered an OpenClassrooms diploma?
  • Up to 100% of your training program funded
  • Flexible start date
  • Career-focused projects
  • Individual mentoring
Find the training program and funding option that suits you best
Example of certificate of achievement
Example of certificate of achievement