Managing Enterprise Database ISYS 464 David Chao Introduction
Managing Enterprise Database ISYS 464 David Chao
Introduction to Databases • The most important component of an information system • Created to support all levels of business operations: – Day-to-day operations • Transaction support systems – Decision-makings • Business intelligence, data warehouse, Big Data – Strategic plans • Enabling new services, new business operations
Definitions • Database: organized collection of logically related data – A group of related files • Data: stored representations of meaningful objects and events: students enroll in courses, customers buy products – Structured: Fixed format record • numbers, text, dates – Unstructured: varying format • Information: data processed to increase knowledge in the person using the data • Metadata: data that describes the properties and context of user data – data about data
Figure 1 -1 Converting Data to Information (1 of 2) (a) Data in context Copyright © 2019, 2016, 2013 Pearson Education, Inc. All Rights Reserved
Figure 1 -1 Converting Data to Information (2 of 2) (b) Summarized data Copyright © 2019, 2016, 2013 Pearson Education, Inc. All Rights Reserved
Table 1 -1 Example Metadata for Class Roster • Descriptions of the properties or characteristics of the data, including data types, field sizes, allowable values, and data context Name Type Length Min Description Source Course Alphanumeric 30 Blank Course ID and name Academic Unit Section Integer 1 1 9 Section number Registrar Semester Alphanumeric 10 Blank Semester and year Registrar Name Alphanumeric 30 Blank Student name Student IS ID Integer 9 Blank Student ID (SSN) Student IS Major Alphanumeric 4 Blank Student major Student IS GPA Decimal 3 0. 0 4. 0 Student grade point average Academic Unit imum Max imum Copyright © 2019, 2016, 2013 Pearson Education, Inc. All Rights Reserved
Traditional File-Based Systems • A collection of application programs that perform services for the end-users. Each program defines and manages its own data.
Example of File Processing • Student file with data: SID, Sname, and GPA • Assuming the file is stored in a CSV file (Comma. Separated Values). • Sample data: – “S 5”, ”Peter”, 3. 0 – “S 1”, “Paul”, 2. 5 • Questions: – How many students? – What is average GPA?
Sequentially Accessing the Student File to Compute Average GPA Dim file. Number, st. Counter As Integer Dim SID, SNAME As String Dim gpa, sum. Gpa As Double file. Number = Free. File() File. Open(file. Number, "c: stdata. txt", Open. Mode. Input) Do While Not EOF(file. Number) Input(file. Number, SID) Input(file. Number, SNAME) *** program defines and manages its own data*** Input(file. Number, gpa) sum. Gpa += gpa st. Counter += 1 Loop Message. Box. Show(sum. Gpa / st. Counter. To. String)
Example: COBOL Program Data Division: FD Input-File. LABEL RECORDS ARE OMITTED DATA RECORD IS Input-Record. 01 Input-Record 05 Name-In PIC X(20). 05 Address-In PIC X(25). 05 City-In PIC X(15). 05 State-Zip-In PIC X(20).
Major Disadvantage of File Processing: Program-Data Dependence • All programs maintain metadata for each file they use. • An application program that deals with data stored externally to it (such as in a file or a database) includes in its source code some structural definition of that data. The extent to which that program is exposed to changes made to that external source is called data dependence. • Example: If student’s major is added to the student data, the application program must change its code. Copyright © 2019, 2016, 2013 Pearson Education, Inc. All Rights Reserved
Figure 1 -2 Old File Processing Systems at Pine Valley Furniture Company Copyright © 2019, 2016, 2013 Pearson Education, Inc. All Rights Reserved
Other Disadvantages of File Processing • Duplication of Data – Different systems/programs have separate copies of the same data – Inconsistent data • Fixed queries – No facilities for asking unplanned, ad hoc queries • Each application program must have its own processing routines for reading, inserting, updating, and deleting data • Limited Data Sharing – No centralized control of data Copyright © 2019, 2016, 2013 Pearson Education, Inc. All Rights Reserved
The Database Approach • Data models – Graphical diagram capturing nature and relationship of data – Enterprise Data Model – high-level entities and relationships for the organization – Project Data Model – more detailed view, matching data structure in database or data warehouse • Entities – Noun form describing a person, place, object, event, or concept – Composed of attributes • Relationships – Between entities – Usually one-to-many one-to-one or many-to-many but can also be Copyright © 2019, 2016, 2013 Pearson Education, Inc. All Rights Reserved
Figure 1 -3 Comparison of Enterprise- and Project-Level Data Models (a) Segment of an enterprise data model (b) Segment of a project data model Copyright © 2019, 2016, 2013 Pearson Education, Inc. All Rights Reserved
Database Approach • Central repository of shared data • The database holds not only the data but also a description of the data. – System catalog (data dictionary, or metadata) • A central location where data descriptions are stored. • Data about data – Program-data independence • Demo: VS Program Data Independence Demo – Web. Application 1, Univ. DB. mdb, mystudent table
ASP. Net Program Data Independence Demo: Application program not affected by data source change protected void Page_Load(object sender, Event. Args e) { string str. Conn = "Provider=Microsoft. Jet. OLEDB. 4. 0; Data Source=C: \Home. Page\Univ. DB. mdb"; Ole. Db. Connection obj. Conn = new Ole. Db. Connection(str. Conn); string str. SQL = "select * from my. Student; "; Ole. Db. Command obj. Comm = new Ole. Db. Command(str. SQL, obj. Conn); obj. Conn. Open(); Ole. Db. Data. Reader obj. Data. Reader; obj. Data. Reader = obj. Comm. Execute. Reader(); Grid. View 1. Data. Source = obj. Data. Reader; Grid. View 1. Data. Bind(); }
Advantages of the Database Approach • Program-data independence – The separation of data descriptions from the application programs that use the data. – Allows the data to change without changing the application programs. • • Planned data redundancy Improved data consistency Improved data sharing Support Ad Hoc queries
Database Management System (DBMS) • A software that enables users to define, create, maintain, and control access to the database. – Data Definition Language (DDL) – Data Manipulation Language (DML) – Control access: • Security, integrity, concurrent access, recovery, support for data communication, etc. – Utility services • File import/export, monitoring facilities, etc. • Support Ad Hoc queries
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
Evolution of DB Systems
Relational DBMS Examples • • • Microsoft: MS Access, SQL Server Oracle: My. SQL, Oracle IBM: DB 2 SAP: HANA Column oriented relational db Etc.
Relational DBMS Demo using MS Access • Every table must have a primary key. • Related records in tables are linked by using key (foreign key). • Querying database using: – Query design view – Structured Query Language
Database Schema • External Schema – User Views – Subsets of Conceptual Schema • Conceptual Schema – This level describes what data is stored in the database and the relationships among the data. – View of the data administrator – E-R models • Internal schema – Logical Schema: • Detailed table design – Physical Schema • File organizations, indexes
Three-schema architecture Different people have different views of the database…these are the external schema The internal schema is the underlying design and implementation
Data Independence • Data independence means that upper levels are unaffected by changes to lower levels. – Logical data independence • Changes to the conceptual level, such as the addition of new entities, attributes, or relationships, should be possible without having to change the existing external level design. – Physical data independence • Changes to the physical level, such as using a different file organization, indexes, should be possible without having to change the conceptual level design.
Three-Level Example Employee Entity • Conceptual design: – Employee entity with attributes: Emp. ID, Emp. Name, Date. Of. Birth, Salary, and Sex. • Internal level: – Logical schema: • • • Emp. ID – 4 characters Emp. Name – 30 characters Date. Of. Birth – Date field 8 bytes Salary – Number(7, 2) Sex – 1 character – Physical schema: • Record size = 4 + 30 + 8 + 7 +1 = 50 bytes • Sequential file with index on Emp. ID field • External level: • Emp. Age. View: Emp. ID, Emp. Name, Age: Year(Now())Year([Birthdate]) • Emp. Salary. View: Emp. ID, Emp. Name, Salary
Benefits of Using Views • Views provide a level of security. • Views provide a mechanism to customize the appearance of the database. • Views provide a consistent, unchanging picture of the database, even if the underlying database is changed.
Database Application • It is a program that interacts with the database at some point in its execution by issuing an appropriate request (typically an SQL statement) to the DBMS. • Database programming
The Range of Database Applications • Personal databases: – Desktop, PDA/Smart Phone • Workgroup databases • Departmental/divisional databases • Enterprise database – 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
The three components in a client/server database application 1. Client: Database application running on a user’s machine: Interface, Menus, forms, reports, etc 2. Processing logic • Business rules 3. Database server
Client Functions • • Manages the user interface. Accepts and checks syntax of user input. Implements business rules. Generates database requests and transmits to server. • Passes response back to user.
Database Server Functions • Checks authorization. • Accepts and processes database requests from clients. • Ensures integrity constraints not violated. • Performs query/update processing and transmits response to client. • Provides concurrent database access, transaction management, and recovery control.
Figure 1 -12 Multi-Tiered Client/Server Database Architecture Copyright © 2019, 2016, 2013 Pearson Education, Inc. All Rights Reserved
Major Database Management Activities • Creating database • Updating database • Querying database
Creating Database • Analysis – System analysis • Data Flow Diagram • Data modeling • Entity Relation Diagram, ERD • Design – Maps the data model on to a target database model. • Implementation: Efficiently store and retrieve data – File organization and index
Updating Database • Insertions, deletions, modifications – Update pattern: • Allow update, Read only, Insertion only, no deletion, etc. • Concurrent processing – Database Read/Write operations – Multiple users • Transaction management
Querying Database • Relational operators • SQL
New Developments in Database • Storage media: In-Memory, Cloud • New Database systems: – Object-Relational database, No. SQL(Not Only SQL) document database • Business Intelligence: – Data warehouse, Big Data Analytics • Types of data: – JSON (Java Script Object Notation) data, CSV (comma separated values), geospatial data, XML etc.
Example of JSON Employee with dependents: { "employee": { “eid”: ”e 1”, "name": "John", "age": 30, "city": "New York" }, "dependents": [{"did": "d 1", "dname": "peter"}, {"did": "d 2", "dname": "paul"}] };
Example of Geo. Spatial Data POINT(X, Y): where X and Y is latitude and longitude value respectively.
Course Overview • An introduction to the design and use of database: – Creating database: • Analysis: Data modeling, ERD, Normalization • Design: Relational database design • Implementation: – Use SQL data definition language to create database – Updating database: • SQL data manipulation language – Querying database: • SQL Select commands • Database management technologies: – – – Improving query performance with index Object relational database, managing JSON documents No. SQL with Mongo. DB Data warehouse Database security and management
Download My. SQL 8 Community Edition • https: //dev. mysql. com/downloads/mysql/
- Slides: 43