Why Do We Need A Database? PDF

Document Details

DauntlessHeliotrope7291

Uploaded by DauntlessHeliotrope7291

Cairo University Computer Science

Ibrahim Eskandar Ibrahim Fadhel

Tags

database systems data management data storage databases

Summary

This document discusses the need for databases and their advantages over spreadsheets. It covers the problems that arise when data grows. Keywords such as data management and database applications are covered. The author is Ibrahim Eskandar Ibrahim Fadhel.

Full Transcript

Page |1 Why Do We Need A Database? When you have some data, and you want to store this data somewhere. This data could be anything. It could be about customers, products, employees, orders, …etc. This data could be in text format, numeric, dates, document files, images, audio, or video. Maybe if y...

Page |1 Why Do We Need A Database? When you have some data, and you want to store this data somewhere. This data could be anything. It could be about customers, products, employees, orders, …etc. This data could be in text format, numeric, dates, document files, images, audio, or video. Maybe if you have data about the customers in your company, the first thing that comes in mind is to open a spreadsheet. Then you start write whatever the data you want to store. It could be the customer name, id, position, and so on. You may add as many as customers, delete any of them later, or even modify on them. Probably this what comes into your mind when you hear the term “database”. Now, we have kind of data, and you stored them in spreadsheets in a way that satisfy your need. That might be OK, because just having a data is not a good enough reason to need a database, and it’s not the problem. The problem is what comes next, and there’s a lot of potential problems. What if you have a bunch of data, maybe 10,0000 customer, “Are you going to scroll down in the spreadsheet to get the 99999 customer?!”, What if the security was a concern, “Do you care about if someone else got an access to your data?”, What if you accidentally put a redundant information, “Is it fine to have duplicate information along the spreadsheet?”. This takes us to the next question, “When do we actually need a database?”. Consider the following potential problems: Presented By Dr. Engineer\Ibrahim Eskandar Ibrahim Fadhel Source: 1- Database Systems, Thomas Connolly & Carolyn Begg 2- Database Systems Concepts Abraham Silberschatz & Henry F. Korth & S. Sudarshan 1 Page |2 1- Size You may have thousands or millions of rows of customers, or any piece of information. 2- Accuracy “Do you care if someone entered incorrect data?”. If yes, nothing could actually prevent me from typing incorrect data into a spreadsheet. 3- Security If the data is sensitive, and you need to restrict the access to the data; It doesn’t need to be shared with everyone. In addition, “Do you need to know who made every change at every point?”. 4- Redundancy If the redundant data (having multiple copies of the same data) will lead to conflict, you would need to have only a non-repeated unique data. 5- Importance “What if you had a disconnect or a crash, and you lost your data?”. You’ve probably felt that pain before. And it’s unacceptable to lose important data like orders of a customer, allergies of a patient, flight bookings, …etc. 6- Overwriting How about having more than one person overwriting the same data at the same time. How about 10 at the same time or 100 people at the same time. You’ll end up with everybody overwriting everybody else’s changes. If you are saying “Yes” to one of these problems, or all of them and more besides, to keep the data reliable, secured, and maintainable. So, you need to have a database. That’s what we are going to discuss here. Presented By Dr. Engineer\Ibrahim Eskandar Ibrahim Fadhel Source: 1- Database Systems, Thomas Connolly & Carolyn Begg 2- Database Systems Concepts Abraham Silberschatz & Henry F. Korth & S. Sudarshan 1 Page |3 What’s A Database? Probably this what comes into your mind when you hear the term “database”. Database A database-management system (DBMS) is a collection of interrelated data and a set of programs to access those data. The collection of data, usually referred to as the database, contains information relevant to an enterprise. The primary goal of a DBMS is to provide a way to store and retrieve database information that is both convenient and efficient. Database Application is a program that interacts with the database at some points in the execution. Database systems are designed to manage large bodies of information. Management of data involves both defining structures for storage of information and providing mechanisms for the manipulation of information. In addition, the database system must ensure the safety of the information stored, despite system crashes or attempts at unauthorized access. If data are to be shared among several users, the system must avoid possible anomalous results. Because information is so important in most organizations, computer scientists have developed a large body of concepts and techniques for managing data. It’s the things you can’t see that are going on in the background; the security, the enforced integrity of the data, the ability to get to it fast and get to it reliably, the robustness; serving lots of people at the same time and even correctly survive crashes and hardware issues without corrupting the data. And that’s what we need to do here; understand how to describe our structure and define those rules, so all these invisible things will actually happen. Presented By Dr. Engineer\Ibrahim Eskandar Ibrahim Fadhel Source: 1- Database Systems, Thomas Connolly & Carolyn Begg 2- Database Systems Concepts Abraham Silberschatz & Henry F. Korth & S. Sudarshan 1 Page |4 Database Management System (DBMS) We often mistakenly say our database is Oracle, MySQL, SQL Server, MongoDB. But, they aren’t databases, they are database management systems (DBMS). The DBMS is the software that would be installed on your personal computer or on a server, then you would use it to manage one or more database. Other definition It’s a structured system to put your data in that imposes rules upon that data, and the rules are yours, because the importance of these problems changes based on your needs. Maybe your problem is the size, while someone else has a smaller amount of data where the sensitivity is a high concern. The database has your actual data and the rules about that data, while the DBMS is the program that surrounds and manages your actual data, and it enforces the rules you specified on your data. The rules for example could be the type of the data, like integer or string, or the relationship between them. Database Management System (DBMS) DBMS facilities: it allows the users to define the database through a Data Definition Language DDL. It allows users to insert update delete and retrieve data from database through Data Manipulation Language DML. In practice it’s very common to have multiple databases. The database that deals with your order and customer information might be completely independent from the database that deals with human resource information. In many organizations, you don’t just have multiple databases but multiple DBMS. Sometimes it’s because one DBMS is better at something than the other. Presented By Dr. Engineer\Ibrahim Eskandar Ibrahim Fadhel Source: 1- Database Systems, Thomas Connolly & Carolyn Begg 2- Database Systems Concepts Abraham Silberschatz & Henry F. Korth & S. Sudarshan 1 Page |5 There are different DBMS, and they are categorized under:  Relational Database Management Systems  Hierarchical Database Systems  Network Database Systems  Object-Oriented Database Systems  NoSQL Database Systems We are going to focus on the relational database management systems (RDBMS). And here’s Why? …  They are the most common used one.  The principles we are going to discuss here are usable across all of them.  If you know you are going to jump into NoSQL databases, most of the introductions assumes you already understand relation database concepts and will use these concepts to explain what’s offered by NoSQL databases. RDBMS are like Oracle, MySQL, SQL Server, SQLite, DB2, …etc. Database Systems Applications Databases are widely used. Here are some representative applications: Enterprise Information ◦ Sales: For customer, product, and purchase information. ◦ Accounting: For payments, receipts, account balances, assets and other accounting information. ◦ Human resources: For information about employees, salaries, payroll taxes, and benefits, and for generation of paychecks. ◦ Manufacturing: For management of the supply chain and for tracking production of items in factories, inventories of items in warehouses and stores, and orders for items. Presented By Dr. Engineer\Ibrahim Eskandar Ibrahim Fadhel Source: 1- Database Systems, Thomas Connolly & Carolyn Begg 2- Database Systems Concepts Abraham Silberschatz & Henry F. Korth & S. Sudarshan 1 Page |6 ◦ Online retailers: For sales data noted above plus online order tracking, generation of recommendation lists, and maintenance of online product evaluations. Banking and Finance ◦ Banking: For customer information, accounts, loans, and banking transactions. ◦ Credit card transactions: For purchases on credit cards and generation of monthly statements. ◦ Finance: For storing information about holdings, sales, and purchases of financial instruments such as stocks and bonds; also, for storing real-time market data to enable online trading by customers and automated trading by the firm. Universities: For student information, course registrations, and grades (in addition to standard enterprise information such as human resources and accounting). Airlines: For reservations and schedule information. Airlines were among the first to use databases in a geographically distributed manner. Telecommunication: For keeping records of calls made, generating monthly bills, maintaining balances on prepaid calling cards, and storing information about the communication networks. Presented By Dr. Engineer\Ibrahim Eskandar Ibrahim Fadhel Source: 1- Database Systems, Thomas Connolly & Carolyn Begg 2- Database Systems Concepts Abraham Silberschatz & Henry F. Korth & S. Sudarshan 1 Page |7 Database Design Process The processes here aren’t the same as the agile model, or iterative approach. They are defined steps to end up having a fully defined database, with its constrains, and the structure. There is no place for many changes, because they are going to cost you a lot. So, you need to be specific, and take things step by step. And, here’s the steps: 1. Requirements Gathering Understanding what you want to do, and what you have is essential before you can dive into designing a database. 2. Conceptual Design We specify the entities, columns, and their relationship. We may use an entity relationship (ER) diagram to visualize the database. The output is: A conceptual schema (described using a conceptual data model like ER model). 3. Logical Design It’s concerned about data model mapping; mapping a conceptual schema (like ER model) into logical schema to provide a much detail description. The output is: A logical schema (described using a logical data model specific to the DBMS like relational model). 4. Physical Design It describes the details of how data is stored. You start by defining (already modeled) tables, how the data is stored, define relationships in DBMS. This requires dealing with the DBMS and could involve SQL. The output is: An internal (physical) schema (described using a physical data model). A database schema is a description of a database structure, data types, and the constraints on the database. Presented By Dr. Engineer\Ibrahim Eskandar Ibrahim Fadhel Source: 1- Database Systems, Thomas Connolly & Carolyn Begg 2- Database Systems Concepts Abraham Silberschatz & Henry F. Korth & S. Sudarshan 1 Page |8 Way to create the Database 1. Why?, and is it feasible? So, first you study “Why we need a database?”, and if it’s feasible or not. You need to check if it could be implemented under current budget, under the current technical skills of your team, within the defined schedule, and if it does contribute to the whole organization objectives or not. 2. Requirements Gathering The first step in whether you are building a mobile application, desktop, or web is to gather the requirements about what’s actually needed. 3. Collecting the requirements If the answer was Yes, then you start collecting the requirements. You can do this by having interviews with all the stakeholders; anyone who will use the system. And try to get any kind of existing data, any kind of spreadsheets, this will help you to in building the database. If there is an existing database, then ask, what’s wrong with it? what’s right with it? These questions will help to avoid any of the current problems. 4. Group related requirements Now, you may need to group related requirements together, resolve any conflicts, or any ambiguity by negotiation with the customers. 5. Specify & Verify the requirements Finally, you specify the requirements, or in other words you write the requirements in a document and validate the requirements with the customer to make sure that everything is on the right track. Presented By Dr. Engineer\Ibrahim Eskandar Ibrahim Fadhel Source: 1- Database Systems, Thomas Connolly & Carolyn Begg 2- Database Systems Concepts Abraham Silberschatz & Henry F. Korth & S. Sudarshan 1