 Assalamu alaikum. Today we are going to discuss the second lecture of the database management system course. Before starting the lecture today, we will briefly review what we did in the previous lecture. In the previous lecture, first of all, we gave an overview of the entire course. Then we discussed some basic definitions. Then we compared the database approach with the traditional file system approach. And finally, we were discussing some advantages of the database approach. We discussed some of the advantages and in this lecture, we will do rest of them. So, let's start with the today's lecture. This slide shows you what we are going to discuss today. We'll start by discussing some more advantages of the database approach. Then we see some cost that we have to keep in mind that we have to pay when we adopt the database approach or database environment. Then the levels of data that we encounter that we see in the database approach. And finally, the database users. Before starting today's topics, first I'll like to explain you some terms that we have been using in the previous lecture. We'll use them today and in the following lectures. First thing is what is data and information? What is link between them and what is difference between them? Data we have already defined as the raw effects. But the thing is most of the time, the raw effects by themselves are not much useful for the user, for you, for example. Here you see on the slide, you see some data on the screen. Obviously, you can guess from the data that there are some names written over here. What do these figures mean? What is this data? And how these figures, these facts are related to each other? This is not clear just from the data. So it means data by itself is not much useful, much meaningful for the user. So then comes the information. A common definition of the information is that the processed data is called information. So what we mean by processing that we do on the data? By processing, it can mean anything, very small thing, as small as just naming the data. And it could mean large sort of computations, many calculation, many computation. So the data is a raw effects and the information is the data after some processing. For example, in our example, in our case, if we simply place these headings on this data item. For example, we say the first column is employee name, second column is age, and third column is salary. It adds some information, it adds some knowledge about this data in your mind. We can further improve the level of information by adding further processing, by doing further processing. For example, we can add this, that this is a company named Supersoft, and the department is sales. So now you see, this is a small example of the processing. And to further beautify it, we place a square around it. Now it becomes a proper screen, proper information in presented in a proper way. So I hope now you're clear what is difference between data and information. Next thing that I have already discussed perhaps the previous lecture, and that you will come across very frequently is schema. What do we mean by schema? Schema is basically a place or repository, where the information about the structure of the data is stored. Because as you must remember, a definition of the database that we discussed in the previous lecture, the definition was that a database is a self-describing collection of integrated records. So when we say self-describing, this thing self-describing, the description of the data is stored in the schema. There are different types of schema, and there are many other things that are stored in the schema, and that you will come across or we will discuss later. But for now it is sufficient for you to know that schema is such a place where the structure of the data, the data which is stored in the database, is stored in the data store or in the information store. Apart from this, another term that you may have heard so far is database application. Database application means such a program, such programs, which are written for a specific purpose. And the data which is stored in the database, they do some activity, some process, for example, storing the data on the database, retrieving it from there, displaying it on anything. Apart from this, to print it on the printer or to delete the data or to update the data, these are different examples that you do with the application programs or database applications. So, for database applications, we can use the term that we can use for the application program, we can call them applications, or database applications. All of this will be the same for our context. Apart from this, another thing that we will discuss frequently is database management system. This is also among the basics. You must be very clear about what is the DBMS. Database management system is a collection of programs that are used to manage the data in the database and the users of the database. These are two major activities that are performed by the DBMS. What do we mean by the management of data? By the management of data, we mean that we define the structure of the data, then we put data into the database, then we make any changes, any updation, any removal in the data that is all done by the, that is all controlled by the DBMS. Likewise, the users of the database, who will access this data, who will perform what sort of operations. This has to be controlled. This has to be checked. And this is the second major activity that the DBMS performs. So from now on, whenever I use the term DBMS, you just bring into your mind that it is a software. It is a collection of program. It is a huge collection of program because nowadays that DBMS, it may consist of thousands of programs, but collectively they are called the DBMS. And its main job is to manage the data and its users. Let's go to the next slide. Here we are going to discuss some other advantages of the database approach. And the first one is data consistency. It means that the database approach provides you a very helpful, very convenient environment where you can maintain the consistency of the database. What do we mean by the data consistency? It means that if the data, if the facts in the database are duplicated, if they are repeated, they do not contradict each other. They do not conflict each other. Rather, they either they are same or they support each other. We said that the file processing environment, since data is repeated and duplicated for every application, there are many chances that your data will be inconsistent. For example, if you do not reflect on changing a place, then there are many chances that the data will be inconsistent. Whereas the database approach, two factors. One, because the database is designed, keeping in mind the sharing of the data. And secondly, the redundancy is controlled. So there are very less chances that the data in the database becomes inconsistent. Wherever necessarily if it is duplicated, then the database approach, the DBMS helps the user, it helps the system to maintain the data consistency. We will discuss this in detail when we will read the Referential Integrary Constraint. Further, better data security. In the previous lecture, we saw a slide where we saw that all the applications, all the application programs, when they access the data, they do it through DBMS. Because all the data access that is controlled by the DBMS, so DBMS is in a very good position that it can check the type of access the user is having, who is accessing it, who is operating it. This means that in the database environment, with the help of DBMS, the data security can be ensured in a very good way. After this, faster development of new applications. The database environment supports faster development of new applications. How? The reason is that we studied that the database is developed, keeping in view the future growth potential of the system and also of the organization. So, when we need to develop a new system, for that application, the data required, either it would be already there in the database, why? I had told you that we design the database while looking at the future needs, so it may be that the data is already present in the database. The second possibility is that the required data is not present there, but the data that is present, we can drive it, compute it. The third possibility is that if the data is not present there, in that case, we have to make the changes in the scheme of the database, mind it, the change in the data in the database and the change in the scheme of the database, these are two different things. The change in the data, if it is properly controlled, if it is being done with the proper authorization, that is no problem at all. But the change in the schema, it could be very, very difficult to manage. If it is handled improperly, it can cause great loss to the database or to the entire system. That is why you must keep in mind that making a change in the schema for the database is a serious thing that you have to do very carefully after very well thought. So, because the data required will be already present, or you will have to add it. In both cases, the database approach makes it very easy. Especially, if we compare it with the file system environment, it is much, much more convenient, much, much more easier to make changes in the schema. So, it helps an easier development of the new applications. Another benefit of the database approach is the economy of scale. This means that, because we define the database with the objectives of sharing the data, sharing the resources, the benefit of this is that your resources, your data, you do not have to repeat it again and again. You are sharing resources, sharing data. This means that your expenses are saved. This means that overall, it provides you with an economy of scale. Better concurrency control. This is something that you will better understand in the later lectures, but just to give you an idea. With the database approach, multiple users can access the data at the same time. This is called concurrent access. This is a very useful thing. But the thing is, it has got great, great complexities in it. And DBMS or the database approach handles it beautifully. It is so, there are so elegant algorithms, there are so elegant techniques that control the concurrent access of the data by multiple users. DBMS is today literally support thousands of users at a time. And the some example that you might have already seen in even Pakistan, like for example, if you see, when we go to any ATM, any service machine in the bank, to get cash, to get money, the ATMs of that bank are so many in the same city. And obviously, on many ATMs at the same time, the users will be accessing their data. Obviously, they want to get money, but they cannot get money until they have a particular check. They are a proper user. You check that they have given their safe pin number or not. So, the card number or pin of that user is in the database. Now, your 20 users are getting money from their own card at the same time, or basically they are accessing the database. But the beauty of this concept is that none of them know that any other user is accessing it. And none of them are aware of it. This is what the DBMS automatically controls and makes sure that there is no disturbance created for the user and even for the data in the database by this concurrent access. We'll discuss in detail later, inshallah. Let's see what is next. Better backup and recovery procedures. Data in the database is very valuable. Second, it becomes huge, especially in big organizations over the period of time. So, there are many chances or there may be that the data store, the storage device, for example, there is a hard disk or any other thing, there are many chances of it being corrupted or corrupt. So, this is such a useful and important thing and it is so complex and complex in such a long time that we can't afford to leave it on just one device. For that purpose, we have to keep different backups of our data. And depending upon the importance of the data, depending upon the critical nature of the data, in such organizations, there are many backups of the data. So, what do we mean and why do we need the backup? And second thing is recovery. Although the environment in which the machines, the computers, or the system run, they are quite secure, there are very few chances of things being broken. Despite this, you can never ignore, you can never ignore altogether this fact that things can crash all of a sudden while doing the work. The light can go away if there is such a big cost because there are many ways to do it. The reason for this is that the database did not properly close, but suddenly it closed. It stopped working. So, the data that you had in the database would not be in the right state, in a consistent state. So, it is necessary that when you turn on the database again, turn on the DBMS, detect and recognize that last time when the system was down, it was not down properly. Detect it and then recover the data. The recovery is that it should be in the right state. How will it be? How will it be done? We will read it later. At this time, this is just enough that you just have the idea, what do we mean by backup and recovery? And to conclude this thing, the database environment provides you a very convenient and very supportive environment for the backup and recovery procedures. But it is not always just the sugar. It means that apart from all those advantages that we just discussed, we have to pay, we have to bear some costs as well. So, we have to keep in mind what are the costs involved in the database approach. Or we can say them some minor disadvantages. First one is higher costs. In the database approach, you have to have some specialized software in the form of DBMS, some specialized hardware, and some specialized personnel as well. So, this means that if you adopt a database system, you will have to pay more costs for these things. So, you should be prepared for that. But believe me, that would definitely be justified. When the database runs and the company benefits, all the costs are justified. Then there is the conversion cost. Conversion cost means that if you have already a system running, it could be either the manual system or it could be a file processing environment. If you decide that you have to switch from your previous environment not towards the database environment, it is a big decision. And companies normally think a lot about it before they act on it. Because there is a lot of effort and a lot of cost involved. So, you must be ready for that and you should keep this thing in mind that conversion cost is involved in this. Apart from this, the recovery in this, although that database supports you or DBMS gives you the facility to recover the data in the case of any crash. But it is more technical. It is more technical to handle. So, you must have the appropriate staff. You should be trained and qualified so that if there is a crash of your database, they can recover it. So, these are some disadvantages that we face in the database approach. Data as resource. The purpose of this slide or this topic is to explain to you the importance of data for an organization. What is a resource? A resource is any asset that is of the value for the company or for the organization and that incurs cost. If you look at any organization, you will see many assets. For example, if you look at a factory, you will see the building of that factory. The machine that was installed in that factory has vehicles, office equipment, even human resources, skilled people. All of them are important for the organization. They are important for the company. Why? Because the company has cost. The company has spent money on it. The other thing is that the company needs the assets of its running and functioning for its business. So, those assets are of value to the company. They will protect those assets. They will not let them mishandle or misuse any one of them. Is data a resource? Yes. How? See, the company does business for profits and profits. So, to earn a company a business on a profitable basis, you need accurate decisions at the appropriate time. To make the right decision at the right time, what do you need? You need information. And from where do you get the information? From data. So, if your data doesn't get you the right time, if you don't get the right data, then you won't be able to make the right decision. When you can't make the right decision, then you are wrong and if you make the right decision, then it will ultimately affect your business, its progress, its development. So, this means that data is valuable like any other resource of the company. Rather, it is more valuable than those resources. Why? Because if you don't use the data properly, you don't get the proper data, and you make wrong decisions, you make untimely decisions, what will happen to your business goes down? And God forbid, if your business goes down, then you won't have those assets that you keep using. This means that you have to protect your data, you have to take care of your data, like you take care of your other assets, other physical assets. I will explain this to you through an example. First, you are running a business, you are running a store, and you deal with different items. In this kind of business, you have one thing that you have to look at which items are your deadstocks. Deadstocks are items that haven't been sold for a long time, and when they haven't been sold, they are in your inventory, so your class has blocked your money. The second thing is called re-order. Re-order means that you have to give any item an order again. If your business level is 15, 20, 25, 30 items, then you can remember that you have to give an order again or you can give an order again. But as you have increased the number of items, then you need to re-order again. Because it is very important to re-order again so that your business flows. So that your customers don't have anything to do and you don't have it available. On the one hand, and on the other hand, you don't have to give an order to block your money. So if you have a small item, then you can remember that if you have more items, then the database in this case can help you a lot. You can find out which items are your deadstocks. You can properly identify them at the right time. And you can see that even if you do it for some time, or for a long time, the item is your dead item, then you can sell it to them, you can do anything. But somehow, whatever money you can take from them, they take it. And this is related to the re-order value. If your item is hot, they sell it quickly. Some items are sold slow, then when should you re-order them? Because in re-order, one thing is that you have to take care of delivery time. That when you will order the item from which you are taking it, it will take you some time to re-order it. So you can re-order it like this at this time so that when it is re-ordered, then you don't have anything in stock at this time. So like this, dead items or re-order value, or re-order point, or re-order time, you can tell your database at the right time on the database, and inform it. And based on this information, you can make the proper decisions. Another example of this is that the customers you have with you are not that efficient. With them, your business terms are not that good, you are not doing a good response, you have to point out them. Because if you have a general policy, that you keep giving credit to people, you keep giving things on the road. But the important point is that what are your customers who are not so good to return to you? So that means when you change your decision about such customers, or modify them. So this information is if there is a long list of your customers. So remember about them, it's not much easy or it won't be that accurate. But if you are giving this work from the database, then you will get the correct information and you can make the proper decisions. And the good decisions, as I have mentioned before, they can help to progress, to prosper your business. On this slide, you can see that you are showing different levels of data. This means that when you work in the database approach, you get the level of data. The first thing you see in this is real world data. Real world data means that the systems running in your real world, where physical things, people, procedures, processes are working, the level of data that exists on that level is called real world data. You can think of any system, your production system, your banking system, the people involved in it. For example, if you look at your bank, the bankers, the assistants on your counters, they exist in the real world. You will have your own properties. For example, their name, their address, etc. So, one level on which we encounter data, on which we see data, on which we get data, is real world data. When you want to transform this data into a database, then the next level of data comes from there. And this level is called the metadata. Metadata means the data about data. Meaning, what is the structure of the data we store in the database? In what form? What constraints and checks are there? As I have said before, the structure of the database is stored in the schema. This means that the schema is in the metadata. So, this is our second level in which we encounter data. And the third level is data occurrences. Data occurrences means that when we feed and put data in the database, that is, when you define the structure of the data in the metadata, then according to that structure, you will put the data in the database and feed it. For example, you say that the name of the data, its structure and its format will be stored in the form of text. So, if there are 100,000,000,000,000,000,000,000,000 employees in a company, then the name of all of them will be in the form of text. As I said earlier, we have to store the age as a number. So, the record of thousands of records will enter the data. And it is obvious that who will have that data? The entities we had on the real world will have data about them. But they were in the real world. Now, they are in the database in the form of data. So, these are the three levels that we encounter in the database environment. On this side, you can see a system in front of you. Some people are doing something in this system. And first of all, they are showing an office environment. And different employees are discussing something. If you take an employee, like we have marked an employee here, now, they have properties like name, age, qualification, and salary. These properties are in the real world. These properties are associated with this physical entity, this employee. These can be different systems. These different systems can be shown here. Now, we come to the metadata level. Here, we first have to store the data about these employees. So, when we define it as metadata, we will say, fine. Amp will be the record type or file name. And the name that will be attributed to it will be the type of text. Age, number, salary, number. So, this is the example of metadata. Now, if you look at the next level, according to this metadata, when you store the data, you will see different employees in front of you. So, based on this slide, you understood how we look at the data on the hungry levels. On this slide, you saw that we will discuss the different types of users of the database. And among them, the first type that we have seen is application programmers. What is an application programmer? We have discussed this before. So, application programmers are those people. They are trained staff who write the application program for a particular system, for a particular organization. For this, to write the application program, the application programmers use different types of tours, different types of software. And that software interacts with the DbMS to process the data. So, one type of user is the application programmers. The other type of users are the end users. End users are those users who ultimately use the database in daily life. That is, application programmers have created an application program for you when you have deployed and implemented that database. Now, the organization for which the database was created will have different application programs for its different users. And these users will use these programs. These users will be called end users. For example, if you look at a factory or a company, the different sections, accounts, sales, production, will be of different users. And every user will be accessing the data for which the application programmer will write the application program. So, we call these users end users. And generally, there are two types of end users. One is called naive users. Nive users are those who don't know much about the database, its structure, its functionality, nor do they need it. All they have to do is that they need to know to use a particular application program. And their problem is that only with that application program can they go from here to there. They don't need to go there. So, the other type of end users are, we call them sophisticated users. These are the users who can access the data through the application programs. But if they want to, they can access the data by removing it. But remember that for an access, apart from the application program, you have to have two major things. One, you have to be familiar with the structure of the data in the database. And you have to have the appropriate skills for that. And secondly, you need to have appropriate authentication for that. Because, as I just said, the end users, the naive users, they don't need to use their pre-written application programs to use the database without permission. So, we call them sophisticated users. Normally, they are in top management. Those who have more authorization, more authentication, they use this one, which we call sophisticated users, who can access the data by removing it from the application program. How? You will know that later. Let's move on to our next slide. Another type of user, which is normally available in the database environment, is the database administrator. Briefly, we call him DBA. DBA is a person who has central control over data and programs that access this data. DBA is a technical person, or he is the person who is responsible for the proper functioning and proper maintenance of the database. So, whatever operations are done on the database, and the safety and protection of the database, its backup, its recovery, all kinds of things are responsible for DBA. So, DBA is an important role, and for the person who works for DBA, he has to be a technical and qualified person. What are the functions of the DBA? Let's discuss them one by one. First thing is schema definition. Schema definition is the thing that is generally the responsibility of the designer. And the designer may be an independent person, a different person, and it may be the DBA itself. It depends upon the scale of the organization, scale of the business. In some cases, both roles are played by one person, i.e. the designer is also a DBA, and in some cases, the designer is someone else, i.e. you hire an independent company from outside, they serve you to develop that system, and when that system develops, and installs the system, then the maintenance and take care of it, that is the duty of the DBA then. But the organizations of moderate size, the schema definition in that, that too comes as a part of the duties of the DBA. Apart from this, another responsibility of the DBA is granting access to the data. As I have already discussed, that there are different types of users, so which user should access to which data, and which type of access will be access to that. All this is defined, obviously, the DBA defines the management, the higher authorities, according to their advice, or according to their direction, but its implementation technically is the responsibility of the DBA. Apart from this, there is routine maintenance of the database. The activities in this are, that it takes the routine, the backup of the database, we have already discussed what the backup means. Apart from that, monitoring disk space, that when you define your database initially, when you implement it in the beginning, then there is no data at all in the database. But as the time passes, the databases grow in size, because according to the functioning, according to the day-to-day working, the data keeps adding. So, as the database adds, it grows in size. So, this has to be monitored, as the database is growing, so is there enough space to handle the size of the database, and secondly, to perform other activities related to the functioning of the database. So, this is also the job of the DBA. Then obviously, monitoring jobs running, the jobs running, it has to be monitored. There are many different activities in this, the people who are using it, are using it correctly or using it incorrectly. For example, if you try to access a particular type of data, and it is not allowed, then is it not trying to access it? If the printer is working, then does the printer stop working on it? Is it not that one job is being printed, and the other many jobs are being collected to wait, then how do we handle this situation? So, the day-to-day working of this routine, is also managed by the DBA. On this slide, what I am showing you, the database environment, the typical components are shown in it. So, the overall picture of the database will be collected in your mind, and all the components that we have discussed, will be shown in it, and how and where and what role it is playing, will be cleared from here. In this, what you are seeing is that, two things are shown, one is the DBMS, and the other is the database. The database of DBMS is related to the fact that it controls how you have to access the data, or how to store it. So, this is the link between DBMS and the database. If you look at it, these are the application programs. The concern of the application programs is, they determine what to get, what kind of data you want from the database. After this, the database designers, we have talked about them, they are the people who design the database. I had just said that, if there is a small size organization, then the DBA is also playing the role of the database designer. But the big organization, the designer in it, it would be another person, not the DBA. So, the database designer designs the database. After that, we have read that the database administrator maintains the DBMS, and its functionality, or its working. Then comes the application programmers. The application programmers develop your application program. These two arrows show that your database administrator, as a representative of the organization for which the database is being developed, assists and helps the designer in the designing phase of the database, and helps the application programmers to develop the application programs. Apart from this, we have end users. These are the people who use the latest database, and that is why they interact with the database through the application program. And see, the concern of the end users is only through the application program. So, you can understand from this that by these end users, we mean the naive users. These components jointly, they are the software part of a database environment. These components jointly are the users of the database. And this is the data. So, this is a typical database environment that you'll find in different organizations. That concludes our today's lecture. In today's lecture, we discussed the basic terminology of the database environment. Then we discussed different advantages and some disadvantages of the database approach. Then we discussed different levels of data. And finally, we saw different types of users in the database environment. In the next lecture, we are going to discuss the architecture of the database. The architecture of the database explains at what different levels we see the data in the database. And in order to make proper use of the data and to design the database properly, it is very important to understand the architecture of the database very well. But in this lecture, I will give you a brief history of the database architecture. As we have discussed before, that the data processing start with the file system environment. Soon people started realizing the drawbacks in the file system environment. And this drawback becomes more apparent in 1960s when Apollo mission was sent to the moon in America. It was realized that as a result of this mission, the huge amount of data generated, we didn't have proper resources to handle and process it. So, after meeting IBM and some other companies, the first database system in the world was launched, defined and implemented. It was called IMS. IMS was very popular at that time. Even today, the mainframe machines are still running on some applications. If this system is not being used in new applications due to certain reasons, which we will discuss later, it became very popular at that time. The special thing about it is that it is based on a data model called hierarchical data model. We will read about it later. But the special thing about it is that it supports one-to-many relationships. This means that it was basically a tree-like structure where you have a root. Further branches, branches, and like that. So, this hierarchical data model was a tree-like structure. And there was only one-to-many relationships between the two entities. This was the result of this data model and the drawback of this DBMS. People started finding it hard to implement the IMS in different applications, in different situations. Then, as a result, another DBMS was made. It was IDS. IDS was based on the network data model. The network data model supported many-to-many relationships. IDS was also popular in the market. Along with it, the different efforts to standardize the architecture of the database started. A committee was formed called CODACIL. It was a conference on data system languages. This committee started the effort to standardize the architecture of the database so that all the databases that are made can be followed. Later, this company formed a different group called DBTG or Database Task Group. They also made their efforts. In 1971, they gave their recommendations. In this recommendation, they proposed a general architecture of the database. This architecture was a two-layered architecture. We said that the system view meant the view of the whole organization. The structure of the whole organization represents the database structure of the whole organization. The user view meant the view of the different user groups. These views were expressed through the sub-schemas. A special language was defined called DDL, i.e. Data Definition Language. Through DDL, we used to define the schema and sub-schemas. The recommendations of DBTG were presented in front of NC. NC is an organization whose work is to fix the standards of different things. NC did not accept these recommendations. NC formed a committee called SPARK. SPARK is the Standards, Planning, and Requirements Committee. SPARK's objective was to suggest an architecture of the database. SPARK suggested an architecture that we still know and are accepted. We call it three-level schema architecture or three-layered architecture. There were three levels of data for two-level architecture. There were system view and user view. There were physical view, conceptual view, and external view. The system view and user view were represented through the sub-schemas. Three-level architecture had three views. They were represented through different schemas. All these schemas are stored in the database. After discussing the history of the database architecture, we will discuss the data in the next lecture. Thank you.