COM 322: Introduction to Database Systems Course Lecturer: Richard Ngwira Nalikule College of Education- COM 322: Introduction to Database Systems 1 Outline of the course 1. 2. 3. 4. 5. 6. 7. 8. Introduction to databases Database System Architecture Relational Data Modelling using ERD Normalization Relational Algebra and Relational Calculus SQL: Data Manipulation SQL: Data Definition Database Administration Nalikule College of Education- COM 322: Introduction to Database Systems 2 Modes of Assessment 1. Continuous Assessment: 40% Distributed as follows • Assignments + Lab work 10% • Quizes/Tests 10% • Mid Semester Examinations 20% 2. End of Semester examinations 60% Nalikule College of Education- COM 322: Introduction to Database Systems 3 Topic 1. Introduction to Databases Nalikule College of Education- COM 322: Introduction to Database Systems 4 Lecture Outline • Introduction • Traditional File-Based Systems • Database Approach • Roles in Database Environment • History of Database • Advantages and Disadvantages of DBMS Nalikule College of Education- COM 322: Introduction to Database Systems 5 Introduction • The database is now such an integral part of our day-to-day life that often we are not aware we are using one. • The information technology has changed rapidly, many computing applications deal with large amounts of information regularly. • As the end user applications has changed significantly in last few decades, there is a challenge to store the large amount of information, retrieve and manage this information in timely manner. • This can be achieving today by making use of services of Database Management System (DBMS). Nalikule College of Education- COM 322: Introduction to Database Systems 6 Introduction Cont’d • Today DBMS not only used to insert, update and delete the data stored in database. • The job of DBMS system is to collect the data, give a systematic representation to it and also provides ways for the data to be modified or extracted by users or other programs. • As the technology has grown rapidly in past four decades, today DBMS has gain its own importance because the data has brought online in the hands of end user through different computer networking. • Our world is driven with lot of exciting applications such as multimedia databases, live streaming of data, digital had made our life much easier to deal with data. Nalikule College of Education- COM 322: Introduction to Database Systems 7 Database Applications The growth of DBMS system has not only benefitted only to the customers or employees in an organization but it has touched all the aspects of our lives. Some of the areas where database is applied are: Transportation: DBMS system can be used for reservation or cancellation of tickets and can be also used to check for the schedules of incoming and outgoing flights. Education: DBMS system can be used by different universities to allow students take admission online, checking the status of vacant seats, enrolment system can be done computerized etc. Banking: DBMS system have completely changed the face of the banking sector. Few decades ago, the banking system was purely the paper based system have now transformed in keeping less of paper work. Nalikule College of Education- COM 322: Introduction to Database Systems 8 Database Applications Sales: DBMS system allows the data to be stored in electronic format by making use of relational databases which allows the data to be stored in highly organised manner. This database allows the information such as information about the customers, products, sales, purchases etc to be stored in database. Manufacturing: DBMS system allows the user to store information about the production of goods, the inventory details, the total number of orders, supply chain information in database so that it allows the decision makers to make critical decisions in timely manner. Human Resource: DBMS has made the life of HR team much better by allowing the team to compute tax deductions, employee wages, retrieving the details of the employees in faster manner as compared to traditional paper based approach which was time consuming. Nalikule College of Education- COM 322: Introduction to Database Systems 9 Traditional File-Based System • It is a collection of application programs that perform services for the endusers such as the production of reports. Each program defines and manages its own data. • A file is simply a collection of records, which contains logically related data. Each record contains a logically connected set of one or more fields, where each field represents some characteristic of the real-world object that is being modeled. • A time when there were no database system, file system was the only way to store, retrieve and manage data. • Consider the scenario of a University administration using file oriented system. Nalikule College of Education- COM 322: Introduction to Database Systems 10 Traditional File-Based System Nalikule College of Education- COM 322: Introduction to Database Systems 11 Traditional File-Based System Assumptions: • A file named “General Data” may contain name, registration no, address and other information of the student. • The file “Grade Data” includes the results of oral exam, written exams, seminars, projects etc. • Class Data additionally comprises the attendances of the students. • While generating the student’s progress report, the three files must be updated to give the consistent report. Nalikule College of Education- COM 322: Introduction to Database Systems 12 An example of a File Nalikule College of Education- COM 322: Introduction to Database Systems 13 Limitations of the File-Based Approach 1. Data Redundancy: • It is possible that the same information may be duplicated in different files. This leads to data redundancy results in memory wastage. 2. Data Inconsistency: • Because of data redundancy, it is possible that data may not be in consistent state. 3. Difficulty in Accessing Data: • Accessing data is not convenient and efficient in file processing system. 4. Limited Data Sharing: • Data are scattered in various files. Also different files may have different formats and these files may be stored in different folders may be of different departments. So, due to this data isolation, it is difficult to share data among different applications. Nalikule College of Education- COM 322: Introduction to Database Systems 14 Limitations of the File-Based Approach 5. Integrity Problems: • Data integrity means that the data contained in the database is both correct and consistent. For this purpose the data stored in database must satisfy correct and constraints. 6. Atomicity Problems: • Any operation on database must be atomic. This means, it must happen in it do entirely or not at all. 7. Concurrent Access Anomalies: • A file-based system must manage, or prevent, concurrency by the application programs. Typically, in a file-based system, when an application opens a file, that file is locked. • This means that no one else has access to the file at the same time. 8. Security Problems: • Database should be accessible to users in limited way. Each user should be allowed to access data concerning his requirements only. Nalikule College of Education- COM 322: Introduction to Database Systems 15 The Database • All the above limitations of the file-based approach can be attributed to two factors: 1. the definition of the data is embedded in the application programs, rather than being stored separately and independently; 2. there is no control over the access and manipulation of data beyond that imposed by the application programs. To become more effective, a new approach was required. What emerged were the database and the Database Management System (DBMS). Nalikule College of Education- COM 322: Introduction to Database Systems 16 The Database • It is a shared collection of logically related data, and a description of this data, designed to meet the information needs of an organization. • Instead of disconnected files with redundant data, all data items are integrated with a minimum amount of duplication. • The database is no longer owned by one department but is a shared corporate resource. • The database holds not only the organization’s operational data but also a description of this data. • It is also defined as a self-describing collection of integrated records. • The description of the data is known as the system catalog (or data dictionary or metadata – the ‘data about data’). • It is the self-describing nature of a database that provides program–data independence. Nalikule College of Education- COM 322: Introduction to Database Systems 17 The Database System and Database management System (DBMS) • Database system is a system to achieve an organized, store a large number of dynamical associated data, facilitate for multi-user accessing to computer hardware, software and data, that it is a computer system with database technology. • A database system aims to achieve a highly organized collection of data along with appropriate tools and applications that facilitate processing and access to that data. • A DBMS is a software system that enables users to define, create, maintain, and control access to the database. • The DBMS is the software that interacts with the users’ application programs and the database. Nalikule College of Education- COM 322: Introduction to Database Systems 18 The Database System and Database management System (DBMS) Nalikule College of Education- COM 322: Introduction to Database Systems 19 Characteristics of Database Management System (DBMS) A modern DBMS has the following characteristics: • Real-world entity: A modern DBMS is more realistic and uses real-world entities to design its architecture. It uses the behavior and attributes too. For example, a school database may use students as an entity and their age as an attribute. • Relation-based tables: DBMS allows entities and relations among them to form tables. A user can understand the architecture of a database just by looking at the table names. • Isolation of data and application: A database system is entirely different than its data. A database is an active entity, whereas data is said to be passive, on which the database works and organizes. DBMS also stores metadata, which is data about data, to ease its own process. Nalikule College of Education- COM 322: Introduction to Database Systems 20 Characteristics of Database Management System (DBMS) • Less redundancy: DBMS follows the rules of normalization, which splits a relation when any of its attributes is having redundancy in values. Normalization is a mathematically rich and scientific process that reduces data redundancy. • Consistency: Consistency is a state where every relation in a database remains consistent. There exist methods and techniques, which can detect attempt of leaving database in inconsistent state. A DBMS can provide greater consistency as compared to earlier forms of data storing applications like file-processing systems. • Query Language: DBMS is equipped with query language, which makes it more efficient to retrieve and manipulate data. A user can apply as many and as different filtering options as required to retrieve a set of data. Nalikule College of Education- COM 322: Introduction to Database Systems 21 Characteristics of Database Management System (DBMS) • ACID Properties: DBMS follows the concepts of Atomicity, Consistency, Isolation, and Durability (normally shortened as ACID). These concepts are applied on transactions, which manipulate data in a database. ACID properties help the database stay healthy in multi-transactional environments and in case of failure. • Multiuser and Concurrent Access: DBMS supports multi-user environment and allows them to access and manipulate data in parallel. Though there are restrictions on transactions when users attempt to handle the same data item, but users are always unaware of them. • Multiple views: DBMS offers multiple views for different users. A user who is in the Sales department will have a different view of database than a person working in the Production department. This feature enables the users to have a concentrate view of the database according to their requirements. Nalikule College of Education- COM 322: Introduction to Database Systems 22 Components of the DBMS Environment • There are five major components in the DBMS environment: hardware, software, data, procedures, and people. Components of DBMS environment Nalikule College of Education- COM 322: Introduction to Database Systems 23 Components of the DBMS Environment • Hardware The DBMS and the applications require hardware to run. • The hardware can range from a single personal computer, to a single mainframe, to a network of computers. • The particular hardware depends on the organization’s requirements and the DBMS used. Some DBMSs run only on particular hardware or operating systems, while others run on a wide variety of hardware and operating systems. • A DBMS requires a minimum amount of main memory and disk space to run, but this minimum configuration may not necessarily give acceptable performance. Nalikule College of Education- COM 322: Introduction to Database Systems 24 Components of the DBMS Environment • Software The software component comprises the DBMS software itself and the application programs, together with the operating system, including network software if the DBMS is being used over a network. • Data The most important component of the DBMS environment, certainly from the end-users’ point of view, is the data. • Procedures Procedures refer to the instructions and rules that govern the design and use of the database. The users of the system and the staff that manage the database require documented procedures on how to use or run the system. • People The final component is the people involved with the system. Nalikule College of Education- COM 322: Introduction to Database Systems 25 Roles in the Database Environment The following types of people are the key participants in the DBMS environment; • data and database administrators • Database designers • application developers and • the end-users. Nalikule College of Education- COM 322: Introduction to Database Systems 26 Data and Database Administrators • The Data Administrator (DA) is responsible for the management of the data resource including database planning, development and maintenance of standards, policies and procedures, and conceptual/logical database design. • The DA consults with and advises senior managers, ensuring that the direction of database development will ultimately support corporate objectives. • The Database Administrator (DBA) is responsible for the physical realization of the database, including physical database design and implementation, security and integrity control, maintenance of the operational system, and ensuring satisfactory performance of the applications for users. Nalikule College of Education- COM 322: Introduction to Database Systems 27 Database Designers a. Logical Database Designer • is concerned with identifying the data (that is, the entities and attributes), the relationships between the data, and the constraints on the data that is to be stored in the database. • The logical database designer must have a thorough and complete understanding of the organization’s data and any constraints on this data (the constraints are sometimes called business rules). • These constraints describe the main characteristics of the data as viewed by the organization. Nalikule College of Education- COM 322: Introduction to Database Systems 28 Database Designers b. Physical Database Designer Decides how the logical database design is to be physically realized. This involves: • mapping the logical database design into a set of tables and integrity constraints; • selecting specific storage structures and access methods for the data to achieve good performance; • designing any security measures required on the data. Nalikule College of Education- COM 322: Introduction to Database Systems 29 Application Developers • These are computer professionals who write application programs, used to develop user interfaces. • The application programmer uses Rapid Application Development (RAD) toolkit or special type of programming languages which include special features to facilitate generation of forms and display of date on screen. Nalikule College of Education- COM 322: Introduction to Database Systems 30 End-Users 1. Naive users: These are the unsophisticated users who interact with the system by invoking one of the application programs that have been written previously. E.g. consider a user who checks for account balance information over the World Wide Web. Such a user access a form, enters the account number and password etc. And the application program on the internet then retrieves the account balance using given account information which s passed to the user. Nalikule College of Education- COM 322: Introduction to Database Systems 31 End-Users 2. Sophisticated users: These users interact with the database using database query language. They submit their query to the query processor. Then Data Manipulation Language (DML) functions are performed on the database to retrieve the data. Tools used by these users are OLAP (Online Analytical Processing) and data mining tools. Nalikule College of Education- COM 322: Introduction to Database Systems 32 Reading Assignment • Discuss the History of Database Management Systems. Nalikule College of Education- COM 322: Introduction to Database Systems 33 Advantages of DBMSs 1. Improved data sharing: The DBMS helps create an environment in which end users have better access to more and better-managed data. Such access makes it possible for end users to respond quickly to changes in their environment. 2. Improved data security: The more users access the data, the greater the risks of data security breaches. Corporations invest considerable amounts of time, effort, and money to ensure that corporate data are used properly. A DBMS provides a framework for better enforcement of data privacy and security policies. Nalikule College of Education- COM 322: Introduction to Database Systems 34 Advantages of DBMS . Better data integration: 3 Wider access to well-managed data promotes an integrated view of the organization’s operations and a clearer view of the big picture. It becomes much easier to see how actions in one segment of the company affect other segments. 4. Minimized data inconsistency: Data inconsistency exists when different versions of the same data appear in different places. The probability of data inconsistency is greatly reduced in a properly designed database. 5. Improved data access: The DBMS makes it possible to produce quick answers to ad hoc queries. Nalikule College of Education- COM 322: Introduction to Database Systems 35 Advantages of DBMS 6. Improved decision making: Better-managed data and improved data access make it possible to generate better-quality information, on which better decisions are based. The quality of the information generated depends on the quality of the underlying data. Nalikule College of Education- COM 322: Introduction to Database Systems 36 Disadvantages of DBMS 1. Increased costs: Database systems require sophisticated hardware and software and highly skilled personnel. The cost of maintaining the hardware, software, and personnel required to operate and manage a database system can be substantial. Training, licensing, and regulation compliance costs are often overlooked when database systems are implemented. 2. Management complexity: Database systems interface with many different technologies and have a significant impact on a company’s resources and culture. Nalikule College of Education- COM 322: Introduction to Database Systems 37 Disadvantages of DBMS 3. Maintaining currency: To maximize the efficiency of the database system, you must keep your system current. Therefore, you must perform frequent updates and apply the latest patches and security measures to all components. 4. Frequent upgrade/replacement cycles: DBMS vendors frequently upgrade their products by adding new functionality. Such new features often come bundled in new upgrade versions of the software. Some of these versions require hardware upgrades. Not only do the upgrades themselves cost money, but it also costs money to train database users and administrators to properly use and manage the new features. Nalikule College of Education- COM 322: Introduction to Database Systems 38 End of Lesson 1 Thank you! Nalikule College of Education- COM 322: Introduction to Database Systems 39