IT 3002 Database Management Systems Introduction to Database Systems Dhananjaya Perera Senior Software Engineer IFS R&D International Why use a Database? • Many people collect things – How about you? • If you collect anything, you probably are familiar with some of the problems of managing a collection – Ex: stamps, photos, paper cuttings • One way to keep track of a collection is to create a database DBMS - Introduction 7 Data, Information and Knowledge • Data – Raw values relating to facts, events or transactions – Raw facts and figures that on their own have no meaning, and used to generate information – Ex: 00500 • Information – Data that has been processed within a context to give it meaning • Data which has meaning and context – Ex: 00500 Postal code of Thimbirigasyaya • Knowledge – Use of information in context, to make decisions or come to a conclusion – Knowledge is the understanding of rules needed to interpret information – Facts, feelings or experience known by a person or group – Ex: Manager could use the information to decide whether or not to raise or lower price DBMS - Introduction 8 File Based System • Collection of application programs that perform services for the users wishing to access information. • File based systems were developed as better alternatives to paperbased filing systems • Each program within a file-based system defines and manages its own data • In the business… • It was common practice for larger companies to have each of its departments looking after its own data DBMS - Introduction 13 Limitations of File-Based Approach • 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. • Duplication of data –Same data is held by different programs. –Wasted space and potentially different values and/or different formats for the same item. • Dependence of data DBMS - Introduction 14 Limitations of File-Based Approach Cont… • Incompatible file formats – Programs are written in different languages, and so cannot easily access each other’s files. • Fixed queries of application programs – Fixed queries of application programs – Programs are written to satisfy particular functions. – Any new requirement needs a new program. • Increased number of different application programs DBMS - Introduction 15 Terminology for Intro… • Database: A collection of related data. • Data: Known facts 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. For example, student grades and transcripts at a university. • Database Management System (DBMS): A software package/system to facilitate the creation and maintenance of a computerized database. • Database System: The DBMS software together with the data itself. Sometimes, the applications are also included. DBMS - Introduction 17 What is a Database? • A database is an organized collection of data that are related in a meaningful way and stored in a common pool which can be accessed by one or many persons for many purposes. • A database is a group of related files. • Ex: UNIVERSITY database for maintaining information concerning students, courses, and grades in a university environment. DBMS - Introduction 18 Database Management System (DBMS) • DBMS is a software system that enables users to define, create, and maintain the computerized database and that provides controlled access to that database. • DBMS is a general-purpose software system that facilitates the processes of defining, constructing, manipulating, and sharing databases among various users and applications. DBMS - Introduction 19 DBMS Functions DATA Dictionary Management Data Storage Management Database Access Languages and Application Programming Interfaces DBMS - Introduction Data Integrity Management Security Management DBMS Presentation and Visualization of data Multiuser Access Control Backup and Recovery Management 20 Database System • The DBMS software together with the data itself. Sometimes, the applications are also included. DBMS - Introduction 21 High level architecture DBMS - Introduction 22 Characteristics of Database System • 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. • 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. DBMS - Introduction 23 Characteristics Cont… • 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. DBMS - Introduction 24 Common Database Systems DBMS - Introduction 25 Major components of Database System • Data – The data in the database; integrated and shared • Hardware – Physically stores data, it can be secondary storage on which the database physically resides together with associated I/O devices • Software – Between the physical database and the users is a layer of software which is known as the DBMS • Users – Database Administrators – Database Designers – End Users – System Analysts and Application Programmers (Software Engineers) DBMS - Introduction 26 Advantages over file-based system • Minimal Data Redundancy • Data files are integrated into a single, logical structure. Each primary fact is recorded (ideally) in only one place in the database. • Improved Data Consistency • By eliminating (or controlling) data redundancy, we greatly reduce the opportunities for inconsistency. • Improved Data Sharing • A database is designed as a shared corporate resource and can be shared by all authorized users. In this way more users share more of the data. DBMS - Introduction 28 Advantages Cont… • Enforcement of Standards • When the database approach is implemented with full management support, the database administration function should be granted single-point authority and responsibility for establishing and enforcing data standards. • Standards include naming conventions, data quality standards and uniform procedures for accessing, updating and protecting data. • Improved Data Integrity • Integrity can be expressed in terms of constraints, which are consistency rules that the database is not permitted to violate. • Increased Concurrency • Many DBMSs allow users to undertake simultaneous operations on the database. The DBMS implements a concurrency control mechanism that prevents database accesses from interfering with one another. DBMS - Introduction 29 Advantages Cont… • Improved Data Accessibility and Responsiveness • With relational database, end users without programming experience can often retrieve and display data, even when it crosses traditional departmental boundaries. • English-like query language SQL and query tools such as Query-By-Example provide such facilities. • Improved Security • DBMS can be used to enforce database security. This may take the form of usernames and passwords to identify people authorized to use the database. • The access that the authorized user is allowed on the data can also be restricted by the operation type (retrieval, delete, update, insert). DBMS - Introduction 30 Disadvantages • Complexity • Size • Cost of DBMS • Additional hardware cost • Cost of conversions • Performance • Higher impact of failure DBMS - Introduction 31 Database Building Blocks • File/Entity/Table – A collection of related records • Record – A record is a group of related fields • Field/Attribute – Field represents an attribute, or a characteristic, or a piece of information DBMS - Introduction 32 Database Building Blocks Cont… Database Table Table Table Record Record Record Attributes DBMS - Introduction 33 Database Users • Database Administrators (DBA) – Administering resources (Database, DBMS and related software) – Responsible for authorizing access to the database – Coordinating and monitoring database’s (its) use – Acquiring software and hardware resources as needed – Accountable for problems such as breach of security or poor system response time • Database Designers – Identify the data to be stored in the database – Choose appropriate structures to represent and store this data DBMS - Introduction 34 Database Users Cont… • Application Programmers – Who develop the programs (Software Engineers) • End Users – database primarily exists for their use – people whose jobs require access to the database for querying, updating, and generating reports – Categories • • • • DBMS - Introduction Casual end users Naive end users Sophisticated end users Stand-alone users 35 Database Users Cont… • Casual end users – occasionally access the database – may need different information each time – use a query language to specify their requests • Naive end users – constantly querying and updating the database – use standard types of queries and updates – need to know very little about the DBMS DBMS - Introduction 36 Database Users Cont… • Sophisticated end users – thoroughly familiarize themselves with the facilities of the DBMS – implement their applications to meet their complex requirements • Stand-alone users – maintain personal databases – use ready-made program packages that provide easy-to-use menu-based or graphics-based interfaces DBMS - Introduction 37 Meta Data • Data that describe the properties or characteristics of other data. • Some of these properties include the name of the data item, data type, length, minimum and maximum allowable values (where appropriate),rules or constraints and a brief description of each data item. • Meta data allow database designers and users to understand what data exist, what the data mean. • Data without clear meaning can be confusing, misinterpreted or erroneous. DBMS - Introduction 38 Example for Meta data DBMS - Introduction 39 Analyzing the Scenario… • Mini World : Part of a university environment • Some mini world entities : • • • • • DBMS - Introduction STUDENTs COURSEs SECTIONs (of COURCEs) (academic) DEPARTMENTs INSTRUCTORs 42 Cont… • Some mini-world relationships: • • • • • • DBMS - Introduction SECTIONs are of specific COURSEs STUDENTs take SECTIONs COURSEs have prerequisite COURSEs INSTRUCTORs teach SECTIONs COURSEs are offered by DEPARTMENTs STUDENTs major in DEPARTMENTs 43 Entities DBMS - Introduction 44 Usage • Queries : • • • Retrieve the transcript—a list of all courses and grades—of ‘Smith’ List the names of students who took the section of the ‘Database’ course offered in fall and their grades in that section List the prerequisites of the ‘Database’ course • Updates • • • DBMS - Introduction Change the class of ‘Smith’ to 2 Create a new section for the ‘Database’ course for this semester Enter a grade of ‘A’ for ‘Smith’ in the ‘Database’ section of last semester 45