Introduction to Database System By: Abenet A. @2022 Course Overview In this course we will cover the following main topics: - Database systems Database models SQL Normalization Database design File Organization Practical/Lab sessions Will start on June 22, 2022 Ms-access SQL ⁃ creating a database ⁃ querying a database 2 Chapter One Chapter Outlines: ⁃ Introduction to Database Systems ⁃ Manual file handling approaches ⁃ File based vs. Database approach ⁃ Characteristics of the Database Approach ⁃ Users and actors of Database system. Chapter Objectives: Understanding the limitations of manual file handling methods The characteristics of file-based systems. The problems with the file-based approach. The meaning of the term database. Some common uses of database systems 3 Introduction Data, information, information System: • Data: is a collection of raw facts and figures • Information: is a processed data in the form that is meaningful to the user. • Information System is a system that: ⁃ Receives data and instruction ⁃ Processes the data as per the instruction ⁃ Produces output ⁃ Stores data/information for future use 4 Introduction… Information System, Organization, and database system • Information System doesn’t exist without organization. That is, organization of data is necessary if data is voluminous. • Information System is a support system for the organizational activity to achieve a certain goal. • A database system is basically a computerized record keeping system. Users of the database can perform a variety of operations. Such as: – Adding new data to empty file – Adding new data to existing file – Retrieving data from existing file – Modifying data to existing file – Deleting data from existing file – Searching for target information 5 Introduction… Data handling approaches: – Data management passes through the different levels of development along with the development in technology and services. – These levels could be best described by categorizing the levels into three levels or types of development/approach. – Even though there is an advantage and a problem overcome at each new data handling approach/level, all methods or approaches of data handling are in use to some extent. – The major three approaches/levels are discussed as follows in this chapter below: 6 Introduction: Why we need to Study Databases? Databases are useful, because of: ─ Many computing applications deal with large amounts of information(Large volumes of data can be stored in one place.) ─ Database systems give a set of tools for storing, searching and managing this information Databases in IT ─ Databases are a ‘core topic’ in Information Technology(IT fields) ─ Basic concepts and skills with database systems are part of the skill set you will be assumed to have as a IT graduate ─ Databases are everywhere (i.e. lots of job opportunities). • E.g. Google ... Database research offers many exciting opportunities. 7 Introduction: Why Study Databases?... Databases are useful, because of: ─ Today, Databases are essential to every business. ─ They are used to maintain internal records, to present data to customers and clients on the World-Wide-Web, and to support many other commercial processes. ─ Database systems are designed to manage large data set in an organization. ─ A database is typically designed so that it is easy to store and access information. A good database is crucial to any company or organization. ─ This is because the database stores all the pertinent details about the company such as employee records, transactional records, salary details etc. ─ To organize information, To be able to get reports from data ─ To protect data – the security features of a database allow you to specify who has access, what data they can see and what they can do with the data ─ To be able to share data 8 Why use Databases? ⁃ Data is a valuable corporate resource which needs adequate, accuracy, consistency and security controls. ⁃ The centralized control of data means that for many applications the data will already exist, and facilitate quicker development. ⁃ Data will no longer be related by application programs, but by the structure defined in the database. ⁃ Database systems give a set of tools for storing, searching and managing this information. ⁃ Easier to maintain systems 9 Introduction to Database System Database can represents some features of the real world entity, sometimes called the mini-world. ─ Database: is a collection of logically related elements. o But a random collection of data cannot correctly be referred to as a database. ─ Data: is known raw facts and figures that can be recorded and have an implicit meaning. ─ Mini-world: Some part of the real world about which data is stored in a database. o Example: student grades and transcripts at a university. A Manufacturing Company with product data – A Bank with account data – A Hospital with patients – A University with Students – A government with planning data – . 10 Introduction to Database System What is a database system? • It is a computerized record keeping system, which stores related data in an organized way. • The overall purpose of a database system is to store information and to allow users to add, delete, retrieve, search, query and update that information upon request. • store information and allow users to add, delete, retrieve, search, query and update that information upon request on demand. • Database System: The DBMS software together with the data itself. • • Sometimes, the applications are also included. Database System: – The DBMS software together with the data itself. » Sometimes, the applications are also included. Note: Database System (DBS) contains: • The Database + The DBMS + Application Programs (what users interact with) 11 What is a database system? • It is a computerized record keeping system, which stores related data in an organized way. • The overall purpose of a database system is to store information and to allow users to add, delete, retrieve, search, query and update that information upon request. • The information concerned can be anything that is deemed to be of significance to the individual or organization the system is intended to serve. • That is, needed to assist in the general process of running the business of that individual or organization. 12 Components of a Database System… • A database system involves four major components, namely, data, hardware, software and users and designers of database. • A brief discussion will follow on each of these components. Data: – The actual data stored in the database system may be stored as a single database or distributed in many distinct files and treated as one. – Is the system a single-user or multi-user one? – How are we going to achieve the utmost possible performance concerning the data storage and maintenance? – What other benefits or drawbacks do we expect as the result of placement or structure of the database?. – These and similar issues might be concerned with the way the data stored in the system. 13 Components of a Database System… Hardware: – This portion of the system consists of secondary storage media (disks, tapes and optical media) that are used to hold the stored data and associated device controllers (hard disk controller, etc.); and the processor(s) and associated main memory that are used to support the execution of the database system software. Software: – This is the software, Database Management System (DBMS) that is responsible for the overall management of communications between the user and the database. – It is found between the data and the users, which, in other words, means the data is entirely covered or shielded by the DBMS software. – The DBMS provides facilities for operating on the database. – This is the most important software component in the overall system that allows the user to interact with the data. Users and Designers of Database: – As people are one of the components in DBS environment, there are group of roles played by different stakeholders of the 14 designing and operation of a database system. Introduction to Database System… • Database can be designed, built, and populated with data for a specific purpose. • A database has an intended group of users and some predetermined applications in which these users are interested. • However, data management passes through the different levels of development along with the development in technology and services. • These levels could best be described by categorizing the levels into three levels of development. • Even though there is an advantage and a problem overcome at each new level, all methods of data handling are in use to some extent. 15 Introduction to Database System… • Data management passes through the different levels of development along with the development in technology and services. • These levels could best be described by categorizing the levels into two levels of development. • Even though there is an advantage and a problem overcome at each new level, all methods of data handling are in use to some extent. • Methods of data handling are : • Manual Approach • Computerized or file based Approach • Data base Approach - The first one is Manual File Handling Approach 16 1. Manual File Handling Systems • In the manual approach, data storage and retrieval follows the primitive and traditional way of information handling where cards and papers are used for the purpose. • Typing the data on paper and put in a file cabinet. • This approach works well if the number of items to be stored is small. • In the manual approach, the data storage and retrieval will be performed using human labour. – Files for as many event and objects as the organization has are used to store information. – Each of the files containing various kinds of information is labelled and stored in one or more cabinets. – The cabinets could be kept in safe places for security purpose based on the sensitivity of the information contained in it. – Insertion and retrieval is done by searching first for the right cabinet then for the right the file then the information. – One could have an indexing system to facilitate access to the data 17 Manual File Handling Systems A manual file handling systems can operated by hand, so it require human effort . Some examples of manual file management systems, might start by building a file with the following structure: • e.g. Personal Calendar o Let us also build our address book: o This calendar is easy to deal with. 18 Limitations Of Using Manual File Handling System Some limitations of using manual file handling system: Problem of Data Organization • Suppose we want to cancel one of our appointments • Two conceptual “entities”, address and calendar with a relationship between them, linking people in the calendar to their contact information. • This link could be based on something as simple as the person's name Problem of Efficiency • Size of your personal address book is probably less than one hundred entries, but there are things we would like to do quickly and efficiently. – “Give me all appointments on 10/28” – “When am I next meeting Dr. Dawit?” – What would happen if you were using a business calendar with hundreds of thousands of entries? 19 Limitations Of Using Manual File Handling System… Example 1: In the University • Students file is kept in the Registrar, Faculty, Dean of Students, Library. • Each has its own purpose of keeping the files. • When registrar officer wants to look for a certain student, he/she go to the student file and search through the system starting from the first entry until he/she find what he/she wants. • This may work well if the number of items to be stored is small. • Questions: – If you change your department does the dean of students know?? – If you change your dormitory, does the library know?? • Necessary information you keep: Name, age, sex, department, dormitory, etc… • You might want to compile possible information: – Give me all females in the Department of Information Technology – Give me all students over the age of 23 – Give me all students who have G.P.A of 3.0 or above & G.P.A less than 2.5 – Give me all students who live in building 205 and who are in department of IT. 20 Limitations Of Using Manual File Handling System… Example 2: In the real state agent Consider yourself as a person working at the company • What type of house do you have for sale? • What type of house do you have for rent? • What three bedroom properties do you have for sale? • What one bedroom properties do you have for sale with a garden and a garage? • What flats do you have for rent within 3 miles of the city center and with two bed rooms • How many apartments to you have with three bed rooms? • Which one of the houses is explicitly for office use? Necessary information you might keep: • Type of house, no. of bed rooms, no. of toilets, garden, service department, distance, all purpose? 21 Limitations Of Using Manual File Handling System… Example 3: In the Library • How do you register in the library? • How does the librarian know the book is its property? • How do you borrow a material? the Process involved?? • How do you return a material?? • What if you do not return a material? • What if you lose a pocket? • How does the library decide which books to get more Option : If the no. of users are small, it is easier to handle. 22 Limitations Of Using Manual File Handling System… Generally, the Problems/ Limitations of the Manual approach are: • Prone to error, • difficult to update, retrieve, integrate • You have the data but it is difficult to compile the information • Limited to small size information and • cross referencing is difficult • Data loss: Due to damaged papers or unable to locate it. • Redundancy: Multiple copies of the same data within the organization. • Inconsistency: Modifications are not reflected on all multiple copies 23 2. Computerized/file based Approach • An alternative approach of data handling is a computerized way of dealing with the information or data. • The computerized approach could also be either decentralized or centralized base on where the data resides in the system. • In this approach every information or data is stored in the computer unlike manual approach. • That means in order to perform any activity, we use computer during computerized approach like storage and retrieval processing. In consequence to overcome the above (Manual file handling system) limitations, two computerized approaches are developed: File based approach decentralized Database approach centralized 24 Computerized / File-Based Approach… After the introduction of Computer for data processing to the business community, the need to use this device for data storage and processing increase. File based data handling approaches were an early attempt to computerize the manual filing system. There were, and still are, several computer applications with file based processing used for the purpose of data handling. Even though the approach evolved over time, the basic structure is still similar to manual approach but not identical. File-Based Approach: is a collection of application programs that perform services for the end-users, such as the production of reports . 25 Computerized /File-Based Approach … File based approach is the decentralized computerized data handling method. In this approach, each program defines and manages its own data. This approach is used to develop a program or a number of programs for each different application. Data is stored in one or more separate computer files 26 Computerized File-Based Approach … • The characteristics of FBA are: – This approach is the decentralized computerized data handling method. That means data is stored in different place inside the computer. – A collection of application programs perform services for the end-users. In such systems, every application program that provides service to end users defines and manages its own data. – Such systems have number of programs for each of the different applications in the organization. – Since every application defines and manages its own data, the system is subjected to serious data duplication problem. – File, in traditional file based approach, is a collection of records which contains logically related data. 27 Limitations of the File Based approach • As business application become more complex demanding more flexible and reliable data handling methods, the shortcomings of the file based system became evident. • These shortcomings include, but not limited to: 1. Separation or Isolation of Data: – Available information in one application may not be known. – Data Synchronisation is done manually. – When data is isolated in separate files, it is difficult to access data that should be available. – This is because; there is no concept of relationship between files. • Therefore, we need to create a temporary file for the participating files. 28 Limitations of the Traditional File Based approach 2. Duplication or redundancy of data: – This is concerning with storage of similar information in multiple files. • The following are some of the disadvantage of redundancy: – It costs time and money to enter the data – It takes up additional storage space (memory space) 3. Inconsistency: this is loss of data integrity. • For instance, if modification in the child table is unable to be reflected on the parent table. 4. Limited data sharing: every application maintains its own data. 5. Lengthy development and maintenance time 29 Limitations of the Traditional File Based approach 6. Incompatible file formats: – Incompatible file formats or data structures: (e.g. “C” and COBOL) between different applications and programs creating inconsistency and difficulty to process jointly. – The structure of file is dependent on the application programs. Incompatibility of files makes them difficult to process jointly. • Example: consider two files with in the same enterprise but in different departments, or in different branches: If the first file is constructed using COBOL and the second file is written using C++, then there will be a problem of integrity. 7. Fixed query processing: which is defined during application development 30 Limitations of the Traditional File Based approach... 8. Data dependency: – on the application- data structure is embedded in the application; hence, a change in the data structure needs to change the application as well. – Changes to an existing structure are difficult to make. • Example: change in the size of Student Name (from 20 characters to 30 characters) requires a new program to convert student file to a new format. – The new program opens original student file, open a temporary file, read records from original student file and write to the temporary file, delete the original student file and finally rename the temporary file as student file. – It is time consuming and Prone to error. 31 Limitations of the Traditional File Based approach… Data is then processed by computer programs – applications The Figure in below shows that how different applications have their own copy of the files they need in order to perform out an activities for which they are responsible. 32 Limitations of File-Based systems… Keeping organizational information using a file system has a number of major disadvantages: Data redundancy and inconsistency • Since different programmers create the files and application programs over a long period, the various files are likely to have: ─ different structures/ formats, ─ the programs may be written in several programming languages, ─ duplication of information in different files o The same data is held by different programs o E.g. The address and telephone number of a particular customer may appear in a file that consists of Sale records and in a file that consists of contract records. This redundancy leads to higher storage and access cost. 33 Limitations of File-Based systems… In addition, it may lead to data inconsistency; that is, the various copies of the same data may no longer agree. o E.g. , a changed customer address may be reflected in Sale records but not elsewhere in the system. Difficulty in accessing data Suppose that one of the bank officers needs to find out the names of all customers who live within a particular postal-code area. • The officer asks the data-processing department to generate such a list. • Because the designers of the original system did not anticipate this request, there is no application program on hand to meet it. • There is, however, an application program to generate the list of all customers. • The bank officer has now two choices: ⁃ either obtain the list of all customers and extract the needed information manually or ⁃ ask a system programmer to write the necessary new application 34 program to carry out each new task Limitations of File-Based systems… • The point here is that conventional file-processing environments do not allow needed data to be retrieved in a convenient and efficient manner. • More responsive data-retrieval systems are required for general use. Separation and isolation of Data Each program maintains its own set of data. • Users of one program may be unaware of potentially useful data held by other programs. Because data are distributed in various files, and files may be in different formats, writing new application programs to retrieve the appropriate data is difficult. 35 Limitations of File-Based systems… Integrity problems • Integrity constraints • Inflexible to add new constraints or change existing ones • The data values stored in the database must satisfy certain types of consistency constraints. o E.g, the balance of certain types of bank accounts may never fall below a prescribed amount (say, 25 birr). • Developers enforce these constraints in the system by adding appropriate code in the various application programs. • However, when new constraints are added, it is difficult to change the programs to enforce them. • The problem is compounded when constraints involve several data items from different files. 36 Limitations of File-Based systems… Atomicity of updates • A computer system, like any other mechanical or electrical device, is subject to failure. • In many applications, it is crucial that, if a failure occurs, the data be restored to the consistent state that existed prior to the failure. o E.g., Transfer of birr 50 from account A to account B should either complete or not happen at all • If a system failure occurs during the execution of the Program, it is possible that the birr 50 was removed from account A but was not credited to account B, resulting in an inconsistent database state. • Clearly, it is essential to database consistency that either both the credit and debit occur, or that neither occur. • That is, the money transfer must be atomic-it must happen in its entirety or not at all. Note: It is difficult to ensure atomicity in a conventional file-processing system. 37 Limitations of File-Based systems… Concurrent access by multiple users For the sake of overall performance of the system and faster response, many systems allow multiple users to update the data simultaneously. Uncontrolled concurrent accesses can lead to inconsistencies o E.g. Consider bank account A, containing birr 500. • If two customers withdraw money (say 50 birr and 100 birr, respectively) from account A at the same time, the result of the concurrent executions may leave the account in an incorrect (or inconsistent)state. 38 Limitations of File-Based systems… Suppose that the programs executing on concern of each withdrawal read the old balance, reduce that value by the amount being withdrawn, and write the result back. ─If the two programs run concurrently, they may both read the value 500 birr, and write back 450 birr and 400 birr, respectively. ─Depending on which one writes the value last, the account may contain either 450 birr or 400 birr, rather than the correct value of $350. To guard against this possibility, the system must maintain some form of supervision. But supervision is difficult to provide because data may be accessed by many different application programs that have not been coordinated previously. 39 Limitations of File-Based systems… Security problems • Not every user of the database system should be able to access all the data. o E.g, in a banking system, payroll personnel need to see only that part of the database that has information about the various bank employees. • They do not need access to information about customer accounts. • But, since application programs are added to the file-processing system for one specific routine, enforcing such security constraints is difficult. These difficulties, among others, prompted the development of database systems. 40 Limitations of File-Based systems… • The limitations for the traditional file based data handling approach arise from two basic reasons. • Arose because: – Definition of the data was embedded in the application program which makes it difficult to modify the database definition easily , rather than being stored separately and independently – No control over the access and manipulation of the data beyond that imposed by the application programs. – The most significant problem experienced by the traditional file based approach of data handling is the “update anomalies”. 41 Limitations of File-Based systems… We have three types of update anomalies; 1. Modification Anomalies: – a problem experienced when one or more data value is modified on one application program but not on others containing the same data set. 2. Deletion Anomalies: – a problem encountered where one record set is deleted from one application but remain untouched in other application programs. 3. Insertion Anomalies: – a problem experienced whenever there is new data item to be recorded, and the recording is not made in all the applications. – And when same data item is inserted at different applications, there could be errors in encoding which makes the new data item to be considered as a totally different object. • Result: The Database and Database Management System (DBMS). 42 3. Database Approach To become more effective, a new approach was required by the name database approach. oWhat emerged were the database and database management systems? What is Database? Database is a shared collection of logically related data (and a description of this data), designed to meet the information needs of an organization. ─Logically related data collection - contains the important entities, objects, attributes, and the relationships between these objects of an organization's information. ─Description of the data – the system catalog (meta-data) provides description of data to enable program data independence. ─Shared collection – can be used simultaneously by many departments, sectors and users. 43 Database Approach… • Database is a structured set of data held in a computer, especially one that is accessible in various ways. • “It is a set of information held in a computer” – Oxford English Dictionary • “One or more large structured sets of persistent data, usually associated with software to update and query the data” – Free On-Line Dictionary of Computing • “Database is a collection of data arranged for ease and speed of search and retrieval”. . Dictionary.com 44 Database Approach… • A database is a collection of related data in an organized way. Most of the time, organization is in tabular form. » E.g. book database Call no QA46 Title Introduction to database Author Bahiru Publisher Addison Wesley No of copies 15 The organization of the database becomes necessary when the data is voluminous. Otherwise, managing data will be very difficult. • E.g. A Manufacturing Company with product data » A Bank with account data » A Hospital with patients » A University with Students » A government with planning data 45 Database Approach… • A database is a collection of related data or information stored in a computer in a systematic way, such that a computer program can read it to answer questions • A database is a collection of organized data used by the applications/systems of an organization. • A database consists of: » Data » Relationships between the data » Constraints on the data – or restrictions e.g. Quantity must be greater than 0 » A schema – describes all the objects in the database (e.g. a table has columns, a column has a data-type and a size) 46 Database Approach… Thus in Database Approach: – Database is just a computerized record keeping system or a kind of electronic filing cabinet. – It is a repository for collection of computerized data files. – Since it is a shared corporate resource, the database is integrated with minimum amount of or no duplication. – It is a collection of logically related data where these logically related data comprises entities, attributes, relationships, and business rules of an organization's information. – In addition to containing data required by an organization, database also contains a description of the data which called as “Metadata” or “Data Dictionary” or “Systems Catalogue” or “Data about Data”. 47 Database Approach… – Since a database contains information about the data (metadata), it is called a self-descriptive collection on integrated records. – The purpose of a database is to store information and to allow users to retrieve and update that information on demand. – Database is designed once and used simultaneously by many users. – Unlike the traditional file based approach in database approach there is program data independence. That is the separation of the data definition from the application. – Thus the application is not affected by changes made in the data structure and file organization. – Each database application will perform the combination of: creating database, reading, updating and deleting data. 48 Database Approach… Databases example : Databases is everywhere! ₋ Web indexes ₋ Train timetables ₋ Library catalogues ₋ Airline bookings ₋ Medical records ₋ Credit card details ₋ Bank accounts ₋ Student records ₋ Stock control ₋ Customer histories ₋ Personnel systems ₋ Stock market prices ₋ Product catalogues ₋ Discussion boards ₋ Telephone directories ₋ and so on… • so that databases touch all aspects of our lives. 49 Database Approach… Application areas of Database Systems: ₋ Banks • Advanced Database Applications 1. Computer-Aided Design (CAD) ₋ HRM ₋ Stock Management electrical ₋ Supermarket ₋ Library Systems ₋ Universities ₋ Etc Stores data relating design, for to mechanical example, and buildings, airplanes, and integrated circuit chips. 2. Computer-Aided Manufacturing (CAM) Stores similar data to CAD, plus data about discrete production. 3. Geographic Information Systems (GIS) GIS database stores spatial and temporal information, that used in land management and underwater exploration. 50 Database application program What is Database application program? • A software program that interacts with the database by issuing an appropriate request (typically an SQL statement) to the DBMS. • The SQL (Structured Query Language), developed by IBM is now the standard query language. 51 Basic Database Terminologies Enterprise ⁃ an organization : A library, a bank, a university, etc. Entity ⁃ Person, place, thing, or event (property of an entity) ⁃ An "object" in the real world that we are interested in: Eg. The object student is an entity Attribute (Field) ⁃ A character or group of characters (alphabetic or numeric), that has a specific meaning. • o E.g. Name, age, telephone, grade, sex, etc. Reports – A report is a database object that comes in handy when you want to present the information in your database for any of the following uses: • Display or distribute a summary of data. Archive snapshots of the data. Provide details about individual records. – If the query is a question... ...then the report is its answer – Reports can be tailored to the needs of the data-user, making the 52 information they extract much more useful. Basic Database Terminologies… File ⁃ A collection of related records. o E.g, a file might contain data about customers; or students of a certain department in a university. Database • Collection of organized Files Queries ⁃ Queries are the information retrieval requests you make to the database ⁃ Your queries are all about the information you are trying to gather • Fields ⁃ Database storage units ⁃ Generic elements of content 53 Basic Database Terminologies… Record : A logically connected set of one or more Attributes that describe a person, place or thing. (Logically related data) ⁃ A simple table showing fields (columns) and records(rows): • And as part of a MS Access database table 54 Advantages of the database approach The advantages of a database approach over the traditional and paper-based methods of record keeping will include the following: ⁃ Database systems offer solutions to all the above problems – A database is a storage space for content / information (data) ⁃ Data independence/reduced maintenance ⁃ Improved data sharing ⁃ Increased application development productivity ⁃ Enforcement of standards ⁃ Improved data quality (constraints) ⁃ Better data accessibility/ responsiveness ⁃ Security, backup/recovery, concurrency 55 Some Common uses of Databases? In a university, There is a database ₋ containing information about yourself, the course you are enrolled in, the dormitory you have been given.. ₋ containing details of Staff who work at the university at personnel, payroll, etc. When you visit your library ₋ There may be a database containing details of the books in the library and details of the users, The database system handles activities such as ₋ Allowing a user to reserve a book ₋ Charging materials to users ₋ Notifying when materials are overdue : Sends out reminders to borrowers who have failed to return books on the due data The system will have a bar code reader to keep track of books and users. 56 Some Common uses of Databases?... In travel agencies • When you make inquiries about a travel, the travel agent may access databases containing flight details o Flight no., date, time of departure, time of arrival • Which passenger is in which flight?? Insurance • When you wish to take out insurance, there is database containing o Your personal details: name, address, age o information on whether you drink or smoke, o Your medical records to determine the cost of the insurance 57 Some Common uses of Databases?... Supermarkets • When you buy goods from some supermarkets, a database will be accessed….. o The checkout assistant will run a bar code reader over the purchases – o It is linked to a database application program, which uses the bar code to find out the price of the item from a products database. o It also reduces the number of such items in stock. o If reorder level falls below the threshold, the system may automatically place an order to obtain more stocks. 58 Benefits of the database approach • Compactness – since it is an electronic data handling method, the data is stored compactly (no need for possibly voluminous paper files). • Speed: – the machine can retrieve and change data faster than a human can. In particular, ad hoc, spur-of-the-moment queries – (“Do we have more red screws than blue ones?”) can be answered quickly without any need for time consuming manual or visual searches. – data storage and retrieval is fast as it will be using the modern fast computer systems. • Accuracy: – timely, accurate and up-to-date information is available on 59 demand at any time. Benefits of the database approach • The foregoing benefits apply with even more force in a multi-user environment where the database is likely to be much larger and much more complex than in the single user case. • In a multi-user environment the database system provides the enterprise with centralized control of its data. The centralized approach has the following advantages: • Data can be shared: ⁃ two or more users can access and use same data instead of storing data in redundant manner for each user. • Improved accessibility of data: ⁃ by using structured query languages, the users can easily access data without programming experience. 60 Benefits of the database approach… • Quality data can be maintained: ⁃ the different integrity constraints in the database approach will maintain the quality leading to better decision making. • Transaction support can be provided: ⁃ basic demands of any transaction support systems are implanted in a full scale DBMS. • Conflicting requirements can be balanced: ⁃ knowing the overall requirements of the enterprise the Database Administrator (DBA) can structure the system so as to provide an overall service that is best for the enterprise. ⁃ For example, a representation can be chosen for the data in storage that gives fast access for the most important applications (possibly at the cost of poorer performance for certain other applications). 61 Benefits of the database approach… • Inconsistency can be avoided: ⁃ controlled data redundancy will avoid inconsistency of the data in the database to some extent. • If there are a number of files which store similar data elements among other sorts of data then when a change is made to a particular data (among the common ones) this change need to be done throughout the system where there is such data stored. • This is not, often, the case. Some of the data might be updated and others left as they are which results in inconsistent information about the same phenomena. 62 Benefits of the database approach… • Redundancy can be reduced: ⁃ isolated data is integrated in database to decrease the redundant data stored at different applications. • In non database or non centralized systems each application or department keeps its own private files. • The files may hold common data elements that exist as part of the enterprises data. • This will lead to considerable redundancy in stored data, with resultant waste in storage space. – For example, a personnel application and an education records application might both own a file that includes department information for employees. • Note that, this is not to say we should eliminate all redundancies. Sometimes there are sound reasons for maintaining several copies 63 of the same data. Benefits of the database approach. • Integrity can be maintained: ⁃ data at different applications will be integrated together with additional constraints to facilitate shared data resource. ⁃ The problem of integrity is the problem of ensuring the data in the database is accurate. ⁃ Inconsistency between two entries that represent the same “fact” is an example of lack of integrity. ⁃ It is more serious in a multi-user environment where one user may enter bad data and other users may go on working on the updated data as if it were a correct one. 64 Benefits of the database approach. • Security majors can be enforced: ⁃ the shared data can be secured by having different levels of clearance and other data security mechanisms. • Improved decision support: ⁃ the database will provide information useful for decision making. • Security restrictions can be applied: ⁃ Since the data is stored in one place/area all accesses to the data can be regulated by the system through some defined rules built into the system. ⁃ The system ensures that the only means of access to the database is through proper channels. ⁃ Different rules can be established for each type of access (retrieve, insert, delete, etc.) to each of information to the database. 65 Benefits of the database approach. • Standards can be enforced: ⁃ the different ways of using and dealing with data by different unite of an organization can be balanced and standardized by using database approach. ⁃ Standardizing data representation is particularly desirable as an aid to data interchange or migration of data between systems. ⁃ Likewise, data naming and documentation standards are also very desirable as they facilitate data sharing and understandability. 66 Benefits of the database approach… • Less labour: ⁃ unlike the other data handling methods, data maintenance will not demand much resource. • Centralized information control: ⁃ since relevant data in the organization will be stored at one repository, it can be controlled and managed at the central level. • Transaction support can be provided: ⁃ basic demands of any transaction support systems are implanted in a full scale DBMS. • Centralized information control: ⁃ since relevant data in the organization will be stored at one repository, it can be controlled and managed at the central level. 67 Limitations and risk of Database Approach • Introduction of new professional and specialized personnel. • Complexity in designing and managing data • The cost and risk during conversion from the old to the new system • High cost to be incurred to develop and maintain the system • Complex backup and recovery services from the users perspective • Reduced performance due to centralization and data independency • High impact on the system when failure occurs to the central system. 68 Characteristics of the Database Approach There are a number of features that distinguish the database approach from the traditional approach of programming with files. In traditional file processing, each user defines and implements the files needed for a specific software application as part of programming the application. In the database approach, a single repository of data is maintained that is defined once and then is accessed by various users. The main characteristics of the database approach versus the file-processing approach are the following: Self-describing nature of a database system: A DBMS catalog stores the description of the database(The description is called meta-data). • This allows the DBMS software to work with different databases. 69 Characteristics of the Database Approach… Insulation between programs and data: ⁃ Called program-data independence. ⁃ Allows changing data storage structures and operations without having to change the DBMS access programs. Data Abstraction: ⁃ A data model is used to hide storage details and present the users with a conceptual view of the database. ⁃ Programs refer to the data model constructs rather than data storage details Support of multiple views of the data: ⁃ Each user may see a different view of the database, which describes only the data of interest to that user. Sharing of data and multiuser transaction processing: ⁃ allowing a set of concurrent users to retrieve and to update the database. ⁃ Concurrency control within the DBMS guarantees that each transaction is correctly executed or completely aborted is a major part of database applications. ⁃ Concurrency control within the DBMS guarantees that each transaction is correctly executed or aborted. 70 Characteristics of the Database Approach… Sharing of data and multiuser transaction processing: ⁃ allowing a set of concurrent users to retrieve and to update the database. ⁃ Concurrency control within the DBMS guarantees that each transaction is correctly executed or completely aborted is a major part of database applications. ⁃ Concurrency control within the DBMS guarantees that each transaction is correctly executed or aborted ⁃ Recovery subsystem ensures each completed transaction has its effect permanently recorded in the database ⁃ OLTP (Online Transaction Processing) is a major part of database applications. ⁃ This allows hundreds of concurrent transactions to execute per second. 71 What is a Database Management System (DBMS) ? A Database Management System (DBMS) is a software package/ system designed to enable users to define, create, and maintain the database and provides controlled access to large collections of database. ⁃ Each DBMS should have facilities to define the database, manipulate the content of the database and control the database. ⁃ These facilities will help the designer, the user as well as the database administrator to discharge their responsibility in designing, using and managing the database. A DBMS is software package used to design, manage, and maintain databases. 72 What is a Database Management System (DBMS) ? It is a software that enables users to define, create, maintain and control access to the database. • used for providing Efficient, Convenient and Safe, Multi- User (many people/programs accessing same database, or even same data, simultaneously) storage of and access to Massive amounts of Persistent (data outlives programs that operate on it) data. Popular databases include: Oracle, MS-Access, MS SQL Server, MySQL, DB2 (IBM), Ingres, Postgre SQL, FoxPro, SQL Server. DBMS is the tool for creating and managing the large amounts of data efficiently and allowing it to persist for a long periods of time. 73 Database Management System… Hence DBMS is a general-purpose software that facilities the processes of defining, constructing, manipulating, and sharing database. Activities of the DBMS: • Defining: involves specifying data types, structure and constraints. • Constructing: is the process of storing the data into a storage media. • Manipulating: is retrieving and updating data from and into the storage. • Sharing: allows multiple users to access data. 74 Database Management System (DBMS) A DBMS also provides a systematic method for creating, updating, storing and retrieving data in a database. It also provides the service of controlling data access, enforcing data integrity, managing concurrency control, and recovery. Having this in mind, a full scale DBMS should at least have the following services to provide to the user. • Data storage, retrieval and update in the database • A user accessible catalogue • Transaction support service: All or None transaction, which minimize data inconsistency. • Concurrency Control Services: access and update on the database by different users simultaneously should be implemented correctly. 75 Database Management System (DBMS)… • Recovery Services: a mechanism for recovering the database after a failure must be available. • Authorization Services (Security): must support the implementation of access and authorization service to database administrator and users. • Support for Data Communication: should provide the facility to integrate with data transfer software or data communication managers. • Integrity Services: rules about data and the change that took place on the data, correctness and consistency of stored data, and quality of data based on business constraints. • Services to promote data independency: between the data and the application • Utility services: sets of utility service facilities like – Importing data – Statistical analysis support – Index reorganization – Garbage collection 76 Functions of a DBMS Generally, the Functions of a DBMS includes: ⁃ Data Storage, Retrieval, and Update. ⁃ A User-Accessible Catalogue. ⁃ Transaction Support. ⁃ Concurrency Control Services. ⁃ Recovery Services. ⁃ Authorization Services. ⁃ Support for Data Communication. ⁃ Integrity Services. ⁃ Services to Promote Data Independence. ⁃ Utility Services. 77 Advantages and Disadvantages of DBMSs Advantages of DBMSs: ⁃ Control of data redundancy ⁃ Data consistency ⁃ Sharing of data ⁃ Improved data integrity ⁃ Improved maintenance through data independence. Disadvantages of DBMSs: ⁃ Complexity ⁃ Cost of DBMS ⁃ Cost of conversion ⁃ Performance ⁃ Higher impact of a failure 78 What the DBMS does? • Additionally, DBMS can also provides users with the following facilities: • Data definition language (DDL): » a language used to define each data element • Data manipulation language (DML) » language used by end-users and programmers to store, retrieve, and access the data. E.g. SQL • Data dictionary: a tool used to store and organize information about the data. This describes the database itself •Data control language (DCL) • Thus, DBMS provides: Persistence, Security, Data independence Integrity and Concurrency 79 Database Management system(DBMS) Environment Note: Database System (DBS) contains: The Database + The DBMS + Application Programs (what users interact with). 80 Components of DBMS Environment A database system consists of • Data (the database) DBAs, application programmers, and ⁃ Used by the organization and a description of end-users. this data called the schema. • Software ⁃ DBMS, operating system, network software People Includes database designers, • We focus mainly on the software • Database systems allow users to (if necessary) and also the application programs. • Hardware ⁃ Can range from a PC to a network of computers. • Procedures ⁃ Instructions and rules that should be applied to the design and use of the database and ⁃ Store ⁃ Update ⁃ Retrieve ⁃ Organise ⁃ Protect their data. DBMS. 81 Components of DBMS Environment... Taking a DBMS as a system, one can describe it with respect to its environment or other systems interacting with the DBMS. To design and use a database, there should be the interaction or integration of hardware, software, data, procedure and people. Generally, the DBMS environment has five components: 1)Hardware ⁃ Can range from a PC to a network of computers. ⁃ are components that one can touch and feel. ⁃ These components are comprised of various types of personal computers, mainframe or any server computers to be used in multiuser system, network infrastructure, and other peripherals required in the system. 82 Components of DBMS Environment... 2)Software ⁃ DBMS, operating system, network software (if necessary) and also the application programs. ⁃ are collection of commands and programs used to manipulate the hardware to perform a function. ⁃ These include application components programs, like the operating DBMS software, systems, network software, language software and other relevant software. 83 Components of DBMS Environment... 3)Data ⁃ Used by the organization and a description of this data called the schema. ⁃ since the goal of any database system is to have better control of the data and making data useful, data is the most important component to the user of the database. • There are two categories of data in any database system: 1) Operational data: is the data actually stored in the system to be used by the user. 2) Metadata: is the data that is used to store information about the database itself. • The structure of the data in the database is called the schema, which is composed of the Entities, Properties of entities, and relationship between entities. 84 Components of DBMS Environment... 4)Procedures: ⁃ Instructions and rules that should be applied to the design and use of the database and DBMS. ⁃ It is the rules and regulations on how to design and use a database. ⁃ It includes procedures like how to log on to the DBMS, how to use facilities, how to start and stop transaction, how to make backup, how to treat hardware and software failure, how to change the structure of the database. 5)People (user): ⁃ this component is composed of the people in the organization that are responsible or play a role in designing, implementing, managing, administering and using the resources in the database. ⁃ These users can be classified as “Actors on the Scene” and “Workers behind the Scene”. 85 Advantages of a DBMS Using a DBMS to manage data has many advantages: 1) Data independence: o Application programs should be as independent as possible from details of data representation and storage. o The DBMS can provide an abstract view of the data to insulate application code from such details. 2) Efficient Data access: o A DBMS utilizes a variety of sophisticated techniques to store and retrieve data efficiently. o This feature is especially important if the data is stored on external storage devices. 86 Advantages of a DBMS… 3)Data Integrity and Security: o If data is always accessed through the DBMS, the DBMS can enforce integrity constraints on the data. • E.g., before inserting salary information for an employee, the DBMS can check that the organization budget is not exceeded. o Also, the DBMS can enforce access controls that govern what data is visible to different classes of users. 4)Data administration: o When several users share the data, centralizing the administration of data can offer significant improvements. o Experienced professionals who understand the nature of the data being managed, and how different groups of users use it, can be responsible for organizing the data representation to minimize redundancy and for fine tuning the storage of the data to make retrieval efficient. 87 Advantages of a DBMS… 5). Concurrent access and crash recovery: o A DBMS schedules concurrent accesses to the data in such a manner that users can think of the data as being accessed by only one user at a time. o Further, the DBMS also protects users from the effects of system failures. 6)Reduced application development time: o Clearly, the DBMS supports many important functions that are common to many applications accessing data stored in the DBMS. o This, in conjunction with the high-level interface to the data, facilitates quick development of applications. • Such applications are also likely to be more robust than applications developed from scratch because many important tasks are handled by the DBMS instead of being implemented by the application. o DBMS includes several important functions that are common to many applications accessing data in the DBMS. 88 When not to use a DBMS • Main inhibitors (costs) of using a DBMS are: ⁃ High initial investment and possible need for additional hardware. ⁃ Overhead for providing generality, security, concurrency control, recovery, and integrity functions. • When a DBMS may be unnecessary/አላስፈላጊ: ⁃ If the database and applications are simple, well defined, and not expected to change. ⁃ If there are stringent(ጥብቅ) real-time requirements that may not be met because of DBMS overhead. ⁃ If access to data by multiple users is not required. • When no DBMS may suffice: ⁃ If the database system is not able to handle the complexity of data because of modeling limitations ⁃ If the database users need special operations not supported by the DBMS. 89 Database Users • Users may be divided into: – Those who actually use and – Those who design and develop the DBMS control the database content, software and related and tools, and – those who design, develop – the computer systems and maintain database operators (called applications (called “Actors “Workers Behind the on the Scene”), and Scene”). 90 Database Users… Actors on the Scene: • Data Administrator Workers behind the Scene: • DBMS designers and implementers: who design and implement different DBMS software. • Database • Administrator Tool Developers: experts who develop software packages that facilitates database system designing and use. • Database Designer Prototype, simulation, code generator developers could be an example. • End Users Independent software vendors could also be categorized in this group. • Operators and Maintenance Personnel: system administrators who are responsible for actually running and maintaining the hardware and software of the database system and the information technology (IT ) facilities. 91 Database Users… • End users – Use the database system to achieve some goal • Application developers – Write software to allow end users to interface with the database system • Database Administrator (DBA) – Designs & manages the database system • Database systems programmer – Writes the database software itself For a small personal database, one person typically defines, constructs, and manipulates the database, and there is no sharing. However, in large organizations, many people are involved in the design, use, and maintenance of a large database with hundreds of users. 92 Users of Database Systems 1. Database Administrators (DBA): • Database Administrator is a person that is responsible for all technical operations or details of the database system. The user that controls the enterprises data resource. • In any organization where many people use the same resources, there is a need for a chief administrator to oversee and manage these resources. • In a database environment, the primary resource is the database itself, and the secondary resource is the DBMS and related software. • Administering these resources is the responsibility of the database administrator (DBA). • The DBA is responsible for authorizing access to the database, coordinating and monitoring the use of the database, and acquiring software and hardware resources as needed. • The DBA is accountable for problems such as security breaches and poor system response time. 93 Users of Database Systems.. Database Administrators (DBA)… • In large organizations, the DBA is assisted by a staff that carries out these functions. • Responsible to oversee, control and manage the database resources (the database itself, the DBMS and other related software) • Responsible for determining and acquiring hardware and software resources • Accountable for problems like poor security, poor performance of the system • Involves in all steps of database development 94 Users of Database Systems.. • We can have further classifications of this role in big organizations having huge amount of data and user requirement. a) Data Administrator (DA): • is responsible on management of data resources. • is involved in database planning, analysis, design (conceptual and logical phase of design), policies and procedures. b) Database Administrator (DBA): • is a more technical role. • It is responsible for the physical realization of the database. • DBA is participates in physical design, implementation, security and integrity control of the database. 95 Users of Database Systems… The functions of the DBA include the following: Defining the conceptual schema: • Will directly participate or help on the process of identifying the content of the database, i.e., what information is to be held in the database and create the corresponding conceptual schema using the conceptual DDL. Defining the internal schema: • The DBA must also decide how the data is to be represented in the stored database and then create the corresponding storage structure definition (the internal schema) using the internal DDL (including associated mapping between the internal and conceptual schema). 96 Users of Database Systems… Liaising with users: • By communicating with users the DBA will ensure that the data they require is available, and to write (or help users write) the necessary external schemas using the applicable external DDL. • Other functions include consulting on application design, providing technical education, assisting with problem determination and resolution, and similar system related professional services. Defining backup and recovery procedures: • In the event of damage to any portion of a database, caused by human error or failure in the hardware or operating system, it is essential to be able to repair the data concerned with the minimum of delay and with as little effect as possible on the rest of the system. • The DBA should define and implement appropriate backup and recovery scheme. 97 Users of Database Systems… Defining security and integrity rules: • Since security and integrity rules are part of the conceptual schema, the conceptual DDL should include facilities for specifying such rules. Monitoring performance and responding to changing requirements: • Periodic performance analysis should be done by the DBA and based on the results obtained propose for improved systems and or do the modifications on the existing data definitions 98 Users of Database Systems… 2. Database Designer (DBD): • Database designers are responsible for identifying the data to be stored in the database and for choosing appropriate structures (data model) to represent and store this data. • These tasks are mostly undertaken before the database is actually implemented and populated with data. • It is the responsibility of database designers to communicate with all prospective database users in order to understand their requirements and to create a design that meets these requirements. • Responsible to define the content, the structure, the constraints, and functions or transactions against the database. • They must communicate with the end-users and understand their needs. 99 Users of Database Systems… • Database Designer (DBD)… • In many cases, the designers are on the staff of the DBA and may be assigned other staff responsibilities after the database design is completed. • Database designers typically interact with each potential group of users and develop views of the database that meet the data and processing requirements of these groups. • Each view is then analysed and integrated with the views of other user groups. • The final database design must be capable of supporting the requirements of all user groups. • Should understand the user requirement and should choose how the user views the database. • Involve on the design phase before the implementation of the database system. 100 Users of Database Systems… • We have two distinctions of database designers, one involving in the logical and conceptual design and another involving in physical design. 1) Logical and Conceptual DBD: ₋ Identifies data (entity, attributes and relationship) relevant to the organization. ₋ Identifies constraints on each data ₋ Understand data and business rules in the organization. ₋ Finally, choose appropriate data model which used to represent those data. 2) Physical DBD: ₋ Take logical design specification as input and decide how it should be physically realized. ₋ Map the logical data model on the specified DBMS with respect to tables and integrity constraints. (DBMS dependent designing) ₋ Select specific storage structure and access path to the database 101 ₋ Design security measures required on the database Users of Database Systems… 3. End Users: – End users are the people whose jobs require access to the database for querying, updating, and generating reports; the database primarily exists for their use. – These are those people who are engaged on processing different types of operations on the database system. – Users are workers, whose job requires accessing the database frequently for various purpose. 102 Users of Database Systems… End Users: • There are several categories of end users: 1. Casual Users: ₋ Users who access the database occasionally/አልፎ አልፎ. ₋ Need different information from the database each time. ₋ Use sophisticated(የተራቀቀ) database queries to satisfy their needs. ₋ They are typically middle or high-level managers or other occasional browsers. 103 Users of Database Systems… 104 Users of Database Systems… 2. Naïve Users: ₋ Unaware of the DBMS ₋ Only access the database based on their access level and demand ₋ Use standard and pre-specified types of queries. Naive or parametric end users make up a sizable portion of database end users. – Their main job function revolves around constantly querying and updating the database, using standard types of queries and updates called canned transactions that have been carefully programmed and tested. 105 Users of Database Systems… Naïve Users: • The tasks that such users perform are varied: – Bank tellers check account balances and post withdrawals and deposits. – Reservation agents for airlines, hotels, and car rental companies check availability for a given request and make reservations. – Employees at receiving stations for shipping companies enter package identifications via bar codes and descriptive information through buttons to update a central database of received and in-transit packages. 3. Sophisticated Users ₋ Are users familiar with the structure of the Database and facilities of the DBMS ₋ Have complex requirements ₋ Have higher level queries 106 Users of Database Systems… • Sophisticated end users include most of the time engineers, scientists, business analysts, and others who thoroughly familiarize themselves with the facilities of the DBMS in order to implement their own applications to meet their complex requirements. • Standalone users maintain personal databases by using ready-made program packages that provide easy-to-use menu-based or graphics-based interfaces. • An example is the user of a tax package that stores a variety of personal financial data for tax purposes. – Mostly maintain personal databases using ready-to-use packaged applications. – An example is a tax program user that creates its own internal database. – Another example is maintaining an address book Generally, End users are those that interact with the system from online workstations or terminals that use an application program developed by application programmers or those that query the system through an interface provided by the DBMS. 107 Users of Database Systems… Thus: ⁃ A typical DBMS provides multiple facilities to access a database. ⁃ Naive end users need to learn very little about the facilities provided by the DBMS; they simply have to understand the user interfaces of the standard transactions designed and implemented for their use. ⁃ Casual users learn only a few facilities that they may use repeatedly. ⁃ Sophisticated users try to learn most of the DBMS facilities in order to achieve their complex requirements. ⁃ Standalone users typically become very proficient in using a specific software package. 108 Users of Database Systems… 4. Application Programmer and Systems Analyst • System analyst determines the user requirement and how the user wants to view the database. • The application programmer implements these specifications as programs; code, test, debug, document and maintain the application program. – Determines the interface on how to retrieve, insert, update and delete data in the database. – The application could use any high level programming language according to the availability, the facility and the required service. • System analysts determine the requirements of end users, especially naive and parametric end users, and develop specifications for standard canned transactions that meet these requirements. 109 Users of Database Systems… Application Programmer and Systems Analyst… – Application programmers implement these specifications as programs; then they test, debug, document, and maintain these canned transactions. – Such analysts and programmers commonly referred to as software developers or software engineers should be familiar with the full range of capabilities provided by the DBMS to accomplish their tasks. – Application programmers who are responsible for writing application programs that use the database using some programming language such as COBOL, Pascal, or a programming language built-in to the DBMS. 110 Users of Database Systems… ⁃ In addition to those who design, use, and administer a database, others are associated with the design, development, and operation of the DBMS software and system environment. ⁃ These persons are typically not interested in the database content itself. ⁃ We call them the workers behind the scene,(DBMS designers and implementers: who design and implement different DBMS software. ) and they include the following categories: 1. DBMS system designers and implementers: • design and implement the DBMS modules and interfaces as a software package. • A DBMS is a very complex software system that consists of many components, or modules, including modules for implementing the catalogue, query language processing, interface processing, accessing and buffering data, controlling concurrency, and handling data recovery and security. • The DBMS must interface with other system software such as the operating system and compilers for various programming languages. 111 Users of Database Systems… 2. Tool developers: – experts who develop software packages that facilitates database system designing and use. – Prototype, simulation, code generator developers could be an example. Independent software vendors could also be categorized in this group. – design and implement tools the software packages that facilitate database modelling and design, database system design, and improved performance. ⁃ Tools are optional packages that are often purchased separately. They include packages for database design, performance monitoring, natural language or graphical interfaces, prototyping, simulation, and test data generation. ⁃ In many cases, independent software vendors develop and market these tools. 112 Users of Database Systems… 3. Operators and Maintenance Personnel: ⁃ system administrators who are responsible for actually running and maintaining the hardware and software of the database system and the information technology facilities. ⁃ Operators and maintenance personnel (system administration personnel are responsible for the actual running and maintenance of the hardware and software environment for the database system. ⁃ Although these categories of workers behind the scene are instrumental in making the database system available to end users, they typically do not use the database contents for their own purposes. 113 Types of SQL Languages 1. Data Definition Language (DDL): – define a database, including creating, altering, and dropping tables and establishing constraints – DDL is a language which describes each data element required by the organization. – The main purpose of this language is to create database and table, insert data inside the database, alter the schema of data inside the database and drop the database include the all data that found inside that database. – DDL has their own commands to achieve the above functions. – This DDL commands are: create, insert, alter and drop commands. 114 Types of SQL Languages… Data Definition Language (DDL)… – The above DDL commands are used by database designer and database administrator. – Commands for setting up schema or the intension of database – These commands are used to setup a database, create, delete and alter table with the facility of handling constraints. – Allows DBA or user to describe and name entitles, attributes and relationships required for the application. – Specification notation for defining the database schema 115 Types of SQL Languages… 2. Data Manipulation Language (DML): – maintain and query a database – DML is a core language which is used to update, retrieve and access the data in the database – Like DDL, DML has their own commands to achieve the above functions. » These commands are: select, update and delete commands. – The above commands are used by end users and database administrator. – Is a core command used by end-users and programmers to store, delete, and update the data in the database. – Provides basic data manipulation operations on data held in the database. – Language for manipulating the data organized by the appropriate data model 116 Types of SQL Languages… Data Manipulation Language can be categorized in to two: 1) Procedural Data Manipulation Languages: allows the user to tell the system what data is needed and exactly how to retrieve the data; 2) Non-Procedural Manipulation Languages: allows the user to state what data is needed rather than how it is to be retrieved. Example: Data Manipulation Language 117 Types of SQL Languages… 3. Data Query Language (DQL): • Language for accessing or retrieving the data organized by the appropriate data model. • Since the required data or Query by the user will be extracted using this type of language, it is also called "Query Language" – Procedural DQL: user specifies what data is required and how to get the data. – Non-Procedural DQL: user specifies what data is required but not how it is to be retrieved. 118 Types of SQL Languages… 4. Data Control Language: – control a database, including administering privileges and committing data – Database is a shared resource that demands control of data access and usage. – Data Control Languages are languages that will helps to control the overall operation of the database. – Like DDL and DML, DCL has their own commands to control the overall operation of the DB. – These commands are: grant and revoke commands which are used by database administrator (DBA). – The database administrator should have the facility to control the overall operation of the system. 119 Types of SQL Languages… Data Control Language (DCL): – The commands include grant or revoke privileges to access the database or particular object within the database and to store or remove database transactions. – This DBA has the power to give privileges to different users to access the database at different level or particular object within the database and to store or remove database transactions by using the above commands. 120 Types of SQL Languages… DDL, DML, DCL, and the database development process: 121 Data Dictionary - Metadata The dictionary or catalogue stores information about the – Descriptions of database database itself objects (tables, users, rules, This is data about data or views, indexes,…) ‘metadata’ • The dictionary holds Almost every aspect of the DBMS uses the dictionary – Information about who is using which data (locks) – Schemas and mappings Data Dictionary: • Due to the fact that a database is a self-describing system, this tool, Data Dictionary, is used to store and organize information about the data stored in the database. 122 Database Development Life Cycle • As it is one component in most information system development tasks, there are several steps in designing a database system. • The major steps in database design are; 1) Planning: ₋ identifying information gap in an organization and propose a database solution to solve the problem. 2) Analysis: ₋ ₋ concentrates more on fact finding about the problem or the opportunity. Feasibility analysis, requirement determination and structuring, and selection of best design method are also performed at this phase. 123 Database Development Life Cycle 3). Design: The activity of specifying the schema of a database in a given data model . Here more emphasis is given to the design phases of the system development life cycle. This phase is further divided into three sub-phases. a) Conceptual Design: concise description of the data, data type, relationship between data and constraints on the data. • There is no implementation or physical detail consideration. • Used to elicit and structure all information requirements b) Logical Design: a higher level conceptual abstraction with selected specific data model to implement the data structure. • It is particular DBMS independent and with no other physical considerations. 124 Database Development Life Cycle c). Physical Design: physical implementation of the upper level design of the database with respect to internal storage and file structure of the database for the selected DBMS. • To develop all technology and organizational specification. 4). Implementation: – the deployment and testing of the designed database for use. 5). Operation and Support: – administering and maintaining the operation of the database system and providing support to users. 125 Database Development Life Cycle 126 Thank You! 127