Hi everyone. Welcome to this fifth and last chapter on binary coding. We saw how to represent information in the form of bits, images and sounds, and how stored data was organized. Now let's talk about databases. What is the use of databases? In everyday life, we often have to manage stocks, a set of customers, sales, a library inventory, a website, and many things that contain numerous information that we would like to manipulate, but without necessarily manipulating information as they are stored in the computer because we are humans, we want to manipulate information We don't want to bother to know that the data has been stored this way in the computer, coded with a certain number of bits, etc. We want an easy way to manipulate this data. Databases are useful for that. There are software called database management systems which are mediators between humans and data as it is stored in the computer. An example of a system is MySQL. Databases are often manipulated by the model called the relational model. In the relational model, there is an important principle, which is called relations which are charts filled with data we want to manipulate. Here there are two charts in my example. The first one is called "Movies" and contains 3 columns: one with the title, one with the director and one with the leading actor. And then a second chart with the screenings with the titles of the movies once again, the theatre in which movies are played, and the screening time. We could have used only one chart to gather all this information, but we would have a lot of duplicated information, as we would repeat the director and actor for example for each screening of the same movie. A lot of information would be stored several times, which is not very practical, and there is no essential reason to store this information in a mixed way. That is why we store them in 2 different charts which have their own part. Then, thanks to the relational model,we can make requests. For example, a request is "Where can I see a movie with this particular actor?" And for that purpose, a language has been developed so that humans can make requests quite easily in the database to find this kind of information. Here, we are going to write a request in the SQL language which will be "Find me theaters - this is the Theater line - by looking at the charts "Movies and Shows"- that I have previously set - and among these charts, you will find the lines for which the movie title and the show title are the same and the actor is the one I'm looking for." The language of this request is relatively easy to understand for humans and it enables to search for the answer of my question in the database, in the 2 charts. The good thing is that we don't care to know how the data is actually stored in the computer,we are just going to write in a fairly simple language, and get an efficient answer. This language will be translated in machine language and will then be quickly executed by the computer who knows where the data is. The interest for databases is to answer questions just like that, very easily, without having to be a programmer. Databases have other advantages, like for example protecting data because nowadays data are extremely valuable. For example, a company's accounts, our vacation pictures and many other things, things that will be stored in computer systems and that we mustn't lose or it will cause lots of problems. And of course, computer systems are not unerring. There are material failures, software bugs, and potentially hacker attacks that sometimes cause data loss. Databases will use systems to avoid these kinds of problems, by ensuring data replication for example, so the data will be stored in several places and if one of the servers breaks down, it will always be possible to get to the data stored elsewhere. It won't change anything for the user except that their data will never be lost. Databases are also used to share data. There are often sets of data manipulated by several users. For example, we can imagine having a system that contains lots of music pieces, with 2 users, Alice and Bob, who have access to it and they can potentially put likes, like on your favourite social network, for the pieces that they like. We can imagine Alice opening a piece and listening to it. At the same time, Bob will listen to the same piece. And as Alice realizes that she likes this piece, she will add a like on it. And shortly after, Bob will do the same thing and add a like. We will realize that Alice's likes is gone and that Bob's is still here. What happened is that when Bob opened the piece, Alice's like was not there yet, when he added his like, it was the only one, and when he closed and saved the piece, only his like appeared and Alice's like disappeared, it has been crushed. In order to avoid those problems, databases will define what we call transactions which are operations that guarantee this kind of problem won't happen. It will enable the creation of concurrent access between the users, and do database modifications without creating a conflict if they access the same thing at the same time. So one person will do their modification and the other one will do theirs so that the likes don't get crushed. What you need to remember from this video is that the computer stores the data in a way that humans don't always understand, with lots of bits used for every data, potentially for compression, a particular order, or a particular memory organization. Humans don't want to have to use all of this while accessing these data. They want to directly manipulate the data easily. Database management systems will be useful for that, they will provide a convenient way to access data, a truly understandable and a reliable way since they will prevent data loss or even concurrent access problems if several users share the same data at the same time and modify it at the same time.