Database Management Systems Modern Database Management 12th Edition Jeffrey A. Hoffer Engr. Hina Iqbal Lecturer CS engr.hinaiqbal@gmail.com © 2005 by Prentice Hall 1 Course Learning Outcomes At the end of the course students are expected to: BT Level PLO PLO Emphasis 1. Explain databases and distinguish different data C2 models and business rules. 1 2 1. Apply Entity Relationship Data (ERD) model to design databases after learning ERD. C3 3 2 1. Formulate relational data model ERD model to implement database. C5 2 2 1. Analyze the relational database for different anomalies. C4 4 2 1. Write relational algebra expressions for manipulating relations. C2 1 2 2 Grading Policy for Theory Assessment Items Theory Assignments Quizzes Mid Exam (after 8 weeks) Final examination (after 16 weeks) Total %age 10 10 30 50 100 3 Books • Modern Database Management Systems by Jeffery hoffer, V. Ramesh, Heikki Topi. • Reference Book: • Database Systems: The Complete Book, 2nd Edition by Hector Garcia-Molina, Jeffrey D. Ullman, Jennifer Widom • Database Systems A Practical Approach to Design, Implementation, and Management, 4th Edition, Thomas Connolly, Carolyn Begg, Addison Wesley, 2005Android Tutorial • Fundamentals of Database Systems by R. Elmasri and S. Navathe. 6th Edition, Addison-Wesley (2010). ISBN-10: 0136086209. 4 Goal • At the end of this course it is expected that each student must be able to develop a database System independently 5 What is Data? • Data are often viewed as the lowest level of abstraction from which information and knowledge are derived. • Raw data refers to a collection of numbers, characters, images or other outputs from devices that collect information to convert physical quantities into symbols, that are unprocessed. • Usually, there are many facts to describe something of interest to us. (For example, employee data to calculate payroll check, send company greetings, inform family in case of emergency 6 Data: Where can we find it? Filing Cabinets Spreadsheets Paper piles Folders Memories And many more … Lists 7 What is a Database? • A database can be of any size and of varying complexity. • A software system that facilitates the creation and maintenance and use of an electronic database – For example, the list of names and addresses of friends – The book catalog of a large library may contain half a million records – A database of much greater size and complexity is maintained to keep track of the tax information filed by taxpayers. 8 Definitions • Database: organized collection of logically related data • Data: stored representations of meaningful objects and events – Structured: numbers, text, dates – Unstructured: images, video, documents • Information: data processed to increase knowledge in the person using the data • Metadata: data that describe the properties or characteristics of end-user data and the context of those data 9 Figure 1-1a Data in context Context helps users understand data Figure 1-1b Summarized data Graphical displays turn data into useful information that managers can use for decision making and interpretation Descriptions of the properties or characteristics of the data, including data types, field sizes, allowable values, and data context Disadvantages of File Processing • Program-Data Dependence – All programs maintain metadata for each file they use • Duplication of Data – Different systems/programs have separate copies of the same data • Limited Data Sharing – No centralized control of data • Lengthy Development Times – Programmers must design their own file formats • Excessive Program Maintenance – 80% of information systems budget 13 Problems with Data Dependency • • • • • Each application programmer must maintain his/her own data Each application program needs to include code for the metadata of each file Each application program must have its own processing routines for reading, inserting, updating, and deleting data Lack of coordination and central control Non-standard file formats 14 Figure 1-3 Old file processing systems at Pine Valley Furniture Company Duplicate Data Problems with Data Redundancy • Waste of space to have duplicate data • Causes more maintenance headaches • The biggest problem: – Data changes in one file could cause inconsistencies – Compromises in data integrity 16 SOLUTION: The DATABASE Approach • Central repository of shared data • Data is managed by a controlling agent • Stored in a standardized, convenient form Requires a Database Management System (DBMS) 17 Database Management System • A software system that is used to create, maintain, and provide controlled access to user databases Order Filing System Invoicing System Payroll System DBMS Central database Contains employee, order, inventory, pricing, and customer data DBMS manages data resources like an operating system manages hardware resources 18 What is a DBMS? • Functions of DBMS – – – – – Insert records Delete records Update records Query records Add and Delete files from the database • In short, DBMS comprises of two main parts – Data Management in the database – User Management associated with the database 19 What is a DBMSs? • Commercial DBMSs Company Product Oracle Oracle 8i, 9i, 10g,11i,11g,12c IBM DB2, Universal Server (from System R, System R*, Starburst) & Informix Microsoft Access, SQL Server Sybase Adaptive Server Informix Dynamic Server NCR Teradata UC Brekeley’s INGRES,M PostgreSQL 20 Advantages of the Database Approach • • • • • • • • • • Program-data independence Planned data redundancy Improved data consistency Improved data sharing Increased application development productivity Enforcement of standards Improved data quality Improved data accessibility and responsiveness Reduced program maintenance Improved decision support 21 Costs and Risks of the Database Approach • New, specialized personnel • Installation and management cost and complexity • Conversion costs • Need for explicit backup and recovery • Organizational conflict 22 Elements of the Database Approach • Data models – Graphical system capturing nature and relationship of data. capture the nature of and relationships among data and are used at different levels of abstraction as a database is conceptualized and designed. A data model is a description of how data should be used to meet the requirements given by the end user – Enterprise Data Model – high-level entities and relationships for the organization – Physical Data Model – more detailed view, matching data structure in database or data warehouse. Physical data models provide the underlying structure of data from which queries are supported to provide information to the enterprise. They are also used to identify how the available data structures can be used to meet the information requirements of the enterprise data model and to provide the basis for developing interfaces between different computer systems. 23 Elements of the Database Approach Cont …. • Relational Databases – Database technology involving tables (relations) representing entities and primary/foreign keys representing relationships • Use of Internet Technology – Networks and telecommunications, distributed databases, clientserver, and 3-tier architectures • Database Applications – Application programs used to perform database activities (create, read, update, and delete) for database users 24 Segment of an Enterprise Data Model Segment of a Project-Level Data Model One customer may place many orders, but each order is placed by a single customer One-to-many relationship One order has many order lines; each order line is associated with a single order One-to-many relationship One product can be in many order lines, each order line refers to a single product One-to-many relationship Therefore, one order involves many products and one product is involved in many orders Many-to-many relationship Figure 1-5 Components of the Database Environment Components of the Database Environment • CASE Tools – computer-aided software engineering CASE tools are automated tools used to design databases and application programs. These tools help with creation of data models and in some cases can also help automatically generate the “code” needed to create the database. • Repository – centralized storehouse of metadata • Database Management System (DBMS) –software for managing the database • Database – storehouse of the data • Application Programs – software using the data • User Interface – text and graphical displays to users • Data/Database Administrators – personnel responsible for maintaining the database • System Developers – personnel responsible for designing databases and software • End Users – people who use the applications and databases 31 Data Administrator • Identified individual person in the organization who has central repository of controlling data • Job of data administrator is to decide – What data should be stored in the database, identify the entities of the interest to the organization – Establishing policies for maintaining and dealing with that data 32 Database Administrator • An individual or group of persons with an overview of one or more databases who controls the design and use of these databases • Provides the necessary technical support for implementing policy decisions of databases • A DBA is the central controller of the database systems who oversees and manages all the resources • Responsible for authorizing access to the database, for coordinating and monitoring its use and for acquiring software and hardware resources as required 33 Functions & Responsibilities of Database Administrator • • • • • • Defining conceptual schema and database creation Storage structure and access-method definition Granting authorization to the users Physical organization modification Routine maintenance Job monitoring 34 Database Users • Users are differentiated by the way they expected to interact with the system • Application programmers – Develop applications that interact with DBMS through DML (Select, Insert, Update , Delete) calls • Sophisticated users – Form requests in a database query language • End users – Invoke one of the existing application programs (e.g., print monthly sales report) – Interact with applications through GUI – E.g. People accessing database over the web, bank tellers, clerical staff 35 The Range of Database Applications • • • • • Personal databases Workgroup databases Departmental/divisional databases Enterprise database Web-enabled databases 36 Figure 1-6 Typical data from a personal database Figure 1-7 Workgroup database with wireless local area network Database Schema • A schema is the structure behind data organization. It is a visual representation of how different table relationships enable the schema’s underlying mission business rules for which the database is created. • A database schema is a visual and logical architecture of a database created on a database management system. • A database schema is a collection of metadata that describes the relationships between objects and information in a database. 40 Two-Tier Architecture: • The two-tier is based on Client Server architecture. The twotier architecture is like client server application. The direct communication takes place between client and server. There is no intermediate between client and server. Because of tight coupling a 2 tiered application will run faster. 41 • The Two-tier architecture is divided into two parts: 1) Client Application (Client Tier) 2) Database (Data Tier) On client application side the code is written for saving the data in the SQL server database. Client sends the request to server and it process the request & send back with data. The main problem of two tier architecture is the server cannot respond multiple request same time, as a result it cause a data integrity issue. • Advantages: • Easy to maintain and modification is bit easy • Communication is faster • Disadvantages: • In two tier architecture application performance will be degraded upon increasing the users. • Cost-ineffective 42 Three-Tier Architecture: • Three-tier architecture typically comprise a presentation tier, a business or data access tier, and a data tier. Three layers in the three tier architecture are as follows: 1) Client layer 2) Business layer 3) Data layer 43 1) Client layer: It is also called as Presentation layer which contains UI part of our application. This layer is used for the design purpose where data is presented to the user or input is taken from the user. For example designing registration form which contains text box, label, button etc. 2) Business layer: In this layer all business logic written like validation of data, calculations, data insertion etc. This acts as a interface between Client layer and Data Access Layer. This layer is also called the intermediary layer helps to make communication faster between client and data layer. 3) Data layer: In this layer actual database comes in the picture. Data Access Layer contains methods to connect with database and to perform insert, update, delete, get data from database based on our input 44 data. Advantages • High performance, lightweight persistent objects • Scalability – Each tier can scale horizontally • Performance – Because the Presentation tier can cache requests, network utilization is minimized, and the load is reduced on the Application and Data tiers. • High degree of flexibility in deployment platform and configuration • Improve Data Integrity • Improved Security – Client is not direct access to database. • Easy to maintain and modification is bit easy, won’t affect other modules • In three tier architecture application performance is good. Disadvantages • Increase Complexity/Effort 45 Enterprise Database Applications • Enterprise Resource Planning (ERP) – Integrate all enterprise functions (manufacturing, finance, sales, marketing, inventory, accounting, human resources) • Data Warehouse – Integrated decision support system derived from various operational databases 46 Figure 1-8 An enterprise data warehouse Evolution of DB Systems Data Abstraction Database Systems provide users with an abstract view of data hiding certain details of how data are stored and maintained 49 Data Abstraction • Physical Level – Describes how data is actually stored • Logical Level – Describes what data are stored in the database and what relationships exist among those data • View Level – Describes only part of the entire database hiding details of data types. – Views can also hide information (e.g., salary) for security purposes 50 Level of Abstraction Payroll Inventory Sales Company database Files on disks Assignment No : 01 • Three Schema Architechure for Database development 52 THANK YOU 53