Database Systems IS 260 Lecture Notes PDF

Summary

These lecture notes provide an introduction to database systems, covering topics such as data models, database management systems (DBMS), SQL, and various database architectures. The notes detail key concepts, different types of databases, and the roles of database users and administrators. It also discusses the importance of transaction and storage management.

Full Transcript

DATABASE SYSTEMS IS 260 BY DR D B NTALASHA COMPUTER SCIENCE DEPT COURSE DESCRIPTION This course provides the students with an introduction to the core concepts in data and information management. It is centered around the core skills of identifying organizat...

DATABASE SYSTEMS IS 260 BY DR D B NTALASHA COMPUTER SCIENCE DEPT COURSE DESCRIPTION This course provides the students with an introduction to the core concepts in data and information management. It is centered around the core skills of identifying organizational information requirements, modeling them using conceptual data modeling techniques, converting the conceptual data models into relational data models and verifying its structural characteristics with normalization techniques, and implementing and utilizing a relational database using an industrial-strength database management system. The course will also include coverage of basic database administration tasks and key concepts of data quality and data security. In addition to developing database applications, the course helps the students understand how largescale packaged systems are highly dependent on the use of DBMSs. Building on the transactional database understanding, the course provides an introduction to data and information management technologies that provide decision support capabilities under the broad business intelligence umbrella. LEARNING OBJECTIVES STUDENTS WILL LEARN TO 1. Understand the role of databases and database management systems in Managing organizational data and information. 2. Understand the historical development of database management systems and Logical data models. 3. Understand the basics of how data is physically stored and accessed. 4. Understand the fundamentals of the basic file organization techniques. 5. Apply information requirements specification processes in the broader systems Analysis & design context. 6. Use at least one conceptual data modeling technique (such as entity- relationship Modeling) to capture the information requirements for an enterprise domain. LEARNING OBJECTIVES 7. Link to each other the results of data/information modeling and process modeling. 8. Design high-quality relational databases. 9. Understand the purpose and principles of normalizing a relational database structure. 10. Design a relational database so that it is at least in 3NF. 11. Implement a relational database design using an industrial-strength database management system, including the principles of data type selection and indexing. 12. Use the data definition, data manipulation, and data control language components of SQL in the context of one widely used implementation of the language. 13. Perform simple database administration tasks. 14. Understand the concept of database transaction and apply it appropriately to an application context. LEARNING OBJECTIVES 15. Understand the basic mechanisms for accessing relational databases from various types of application development environments. 16. Understand the role of databases and database management systems in the context of enterprise systems. 17. Understand the key principles of data security and identify data security risk and violations in data management system design. 18. Understand the core concepts of data quality and their application in an organizational context. 19. Understand the difference between on-line transaction processing (OLTP) and online analytic processing (OLAP), and the relationship between these concepts and business intelligence, data warehousing and data mining. 20. Create a simple data warehouse (“data mart”). 21. Understand how structured, semi-structured, and unstructured data are all essential elements of enterprise information and knowledge management. In this context, the students will learn the principles of enterprise search. TOPICS Database Approach Mapping Conceptual Schema To A Data security management Relational Schema o Basic data security principles  Types Of Database Management Systems  Normalization o Data security implementation  Basic File Processing Concepts  Physical Data Model  Data quality management  Physical Data Storage Concepts O Indexing o Data quality principles  File Organizations Techniques o Data types o Data quality audits  Conceptual Data Model  Database languages o Data quality improvement O Entity-relationship Model o SQL: DDL, DML, and DCL  Business intelligence O Object-oriented Data Model  Data and database administration  On-line analytic processing O Specific Modeling Grammars  Transaction processing  Data warehousing  Logical Data Model  Using a database management  Data mining system from an application O Hierarchical Data Model development  Enterprise search O Network Data Model  environment O Relational Data Model  Use of database management O Relations And Relational systems in an enterprise system Structures context O Relational Database Design  Data / information architecture CLASS TIME FRIDAY : 11 HRS AND TUESDAY 15 HRS ASSESSMENTS TESTS AND ASSIGNMENTS : 40% FINAL EXAM : 60% INTRODUCTION TO DATABASE A database is an organized collection of data that is stored and managed to allow for easy access, retrieval, and manipulation. Databases are fundamental in virtually every field today, as they enable the storage and processing of large volumes of data efficiently. LEARNING OUTCOMES Student will be able to understand the conceptual design of database Student will be able to describe the important of good database design Student will be able to apply database design for a real business WHY STUDY DATABASES? DATABASES ARE USEFUL DATABASES IN CS/CE/IT/IS/SE Many computing Databases are a ‘core applications deal with topic’ in computer science large amounts of Basic concepts and skills information with database systems are Database systems give a part of the skill set you set of tools for storing, will be assumed to have searching and managing as a CS/CE/IT/IS/SE this information graduate WHY ARE DATABASES IMPORTANT? Data management - databases help in storing, organizing, and managing data systematically. Quick retrieval - they allow users to retrieve specific information efficiently. Support for applications - modern applications, from banking systems to social media platforms, rely on databases to function Data integrity and security - databases enforce rules to maintain the accuracy and security of the data. Scalability - they can handle increasing amounts of data as systems grow. KEY CONCEPTS IN DATABASES Data -raw facts and figures. Example: names, phone numbers, and addresses Database management system (DBMS): - software that manages and controls access to the database. Examples: mysql, postgresql, oracle database, microsoft SQL server, mongodb. Tables (relational databases) - a table is a collection of related data stored in rows (records) and columns (fields).Example: A "customers" table might have columns for customerid, name, and email. KEY CONCEPTS IN DATABASES Queries - commands used to interact with the database, typically written in SQL (structured query language).Example: SELECT * FROM customers; retrieves all records from the "customers" table. Primary key - a unique identifier for a record in a table.Example: customerid might be a primary key in the "customers" table. Relationships - one-to-one: each record in table A relates to one record in table B. One-to-many - A record in table A relates to multiple records in table B. Many-to-many: records in table A relate to multiple records in table B, and vice versa. TYPES OF DATABASES Relational databases organize data into tables with defined relationships. Use SQL for querying. Example: mysql, postgresql. Nosql databases handle unstructured or semi-structured data. Scalable and flexible for modern applications. Example: mongodb, cassandra. Hierarchical databases organize data in a tree-like structure. Example: IBM information management system (IMS). Network databases: data is represented as a graph with multiple relationships. Example: integrated data store (IDS). Object-oriented databases store data in the form of objects, as in object-oriented programming. ADVANTAGES OF DATABASES Efficiency: fast data retrieval and manipulation. Scalability: handles large and growing datasets. Data integrity: maintains consistency and accuracy of data. Security: protects data from unauthorized access. Concurrency: allows multiple users to access the database simultaneously. APPLICATIONS OF DATABASES Business - customer management, inventory systems, and financial transactions. Healthcare - patient records and research data. Education - student information systems and online learning platforms. Entertainment - streaming services and gaming systems. Social media - managing user profiles, posts, and interactions. DATABASE MANAGEMENT SYSTEM (DBMS) Collection of interrelated data Set of programs to access the data DBMS contains information about a particular enterprise DBMS provides an environment that is both convenient and efficient to use. Database applications: Banking: all transactions Airlines: reservations, schedules Universities: registration, grades Sales: customers, products, purchases Manufacturing: production, inventory, orders, supply chain Human resources: employee records, salaries, tax deductions Databases touch all aspects of our lives PURPOSE OF DATABASE SYSTEM In the early days, database applications were built on top of file systems Drawbacks of using file systems to store data: Data redundancy and inconsistency Multiple file formats, duplication of information in different files Difficulty in accessing data Need to write a new program to carry out each new task Data isolation — multiple files and formats Integrity problems Integrity constraints (e.G. Account balance > 0) become part of program code Hard to add new constraints or change existing ones PURPOSE OF DATABASE SYSTEMS (CONT.) Drawbacks of using file systems (cont.) Atomicity of updates Failures may leave database in an inconsistent state with partial updates carried out E.G. Transfer of funds from one account to another should either complete or not happen at all Concurrent access by multiple users Concurrent accessed needed for performance Uncontrolled concurrent accesses can lead to inconsistencies E.G. Two people reading a balance and updating it at the same time Security problems LEVELS OF ABSTRACTION Physical level describes how a record (e.G., Customer) is stored. Logical level: describes data stored in database, and the relationships among the data. Type customer = record name : string; street : string; city : integer; end; View level: application programs hide details of data types. Views can also hide information (e.G., Salary) for security purposes. VIEW OF DATA An architecture for a database system INSTANCES AND SCHEMAS Similar to types and variables in programming languages Schema – the logical structure of the database E.G., The database consists of information about a set of customers and accounts and the relationship between them) Analogous to type information of a variable in a program Physical schema: database design at the physical level Logical schema: database design at the logical level Instance – the actual content of the database at a particular point in time Analogous to the value of a variable Physical data independence – the ability to modify the physical schema without changing the logical schema Applications depend on the logical schema In general, the interfaces between the various levels and components should be well defined so that changes in some parts do not seriously influence DATA MODELS A collection of tools for describing Data Data relationships Data semantics Data constraints Entity-relationship model Relational model Other models: Object-oriented model Semi-structured data models Older models: network model and hierarchical model ENTITY-RELATIONSHIP MODEL EXAMPLE OF SCHEMA IN THE ENTITY-RELATIONSHIP MODEL ENTITY RELATIONSHIP MODEL (CONT.) E-R model of real world Entities (objects) E.G. Customers, accounts, bank branch Relationships between entities E.G. Account A-101 is held by customer johnson Relationship set depositor associates customers with accounts Widely used for database design Database design in E-R model usually converted to design in the relational model (coming up next) which is used for storage and processing RELATIONAL MODEL Attributes EXAMPLE OF TABULAR DATA IN THE RELATIONAL MODEL customer- customer- customer- account- Customer name street city number -id 192-83-7465 Johnson Alma Palo Alto A-101 019-28-3746 Smith North Rye A-215 192-83-7465 Johnson Alma Palo Alto A-201 321-12-3123 Jones Main Harrison A-217 019-28-3746 Smith North Rye A-201 A SAMPLE RELATIONAL DATABASE DATA DEFINITION LANGUAGE (DDL) Specification notation for defining the database schema E.G. Create table account ( account-number char(10), balance integer) DDL compiler generates a set of tables stored in a data dictionary Data dictionary contains metadata (i.E., Data about data) Database schema Data storage and definition language language in which the storage structure and access methods used by the database system are specified Usually an extension of the data definition language DATA MANIPULATION LANGUAGE (DML) Language for accessing and manipulating the data organized by the appropriate data model DML also known as query language Two classes of languages Procedural – user specifies what data is required and how to get those data Nonprocedural – user specifies what data is required without specifying how to get those data SQL is the most widely used query language SQL SQL: widely used non-procedural language E.G. Find the name of the customer with customer-id 192-83-7465 select customer.Customer-name from customer where customer.Customer-id = ‘192-83-7465’ E.G. Find the balances of all accounts held by the customer with customer-id 192-83-7465 select account.Balance from depositor, account where depositor.Customer-id = ‘192-83-7465’ DATABASE USERS Users are differentiated by the way they expect to interact with the system Application programmers – interact with system through DML calls Sophisticated users – form requests in a database query language Specialized users – write specialized database applications that do not fit into the traditional data processing framework Naïve users – invoke one of the permanent application programs that have been written previously E.G. People accessing database over the web, bank tellers, clerical staff DATABASE ADMINISTRATOR Coordinates all the activities of the database system; the database administrator has a good understanding of the enterprise’s information resources and needs. Database administrator's duties include: Schema definition Storage structure and access method definition Schema and physical organization modification Granting user authority to access the database Specifying integrity constraints Acting as liaison with users Monitoring performance and responding to changes in requirements TRANSACTION MANAGEMENT A transaction is a collection of operations that performs a single logical function in a database application Transaction-management component ensures that the database remains in a consistent (correct) state despite system failures (e.G., Power failures and operating system crashes) and transaction failures. Concurrency-control manager controls the interaction among the concurrent transactions, to ensure the consistency of the database. STORAGE MANAGEMENT Storage manager is a program module that provides the interface between the low-level data stored in the database and the application programs and queries submitted to the system. The storage manager is responsible to the following tasks: Interaction with the file manager Efficient storing, retrieving and updating of data OVERALL SYSTEM STRUCTURE APPLICATION ARCHITECTURES Two-tier architecture: E.g. client programs using ODBC/JDBC to communicate with a database Three-tier architecture: E.g. web-based applications, and applications built using “middleware” END