Docsity

Database Programming: An Introduction to Database Systems and Relational Models, Lecture notes of Database Programming

Partial preview of the text

Download Database Programming: An Introduction to Database Systems and Relational Models and more Lecture notes Database Programming in PDF only on Docsity!

Database Programming

By Mwavu Rogers Department of Information Technology Faculty of Computing and Informatics Mbarara University of Science and Technology

Overview

❖Introduction to database systems

❖Data Modeling: The Entity-Relationship Diagram

❖The Relational Model and Normalization

❖Physical Database Design

❖SQL - A Standard Navigation Language for Relational

Databases

❖Introduction to Two-Tier and Three-Tier Architectures,

and the Internet Database Environment

Introduction to database system

❖Before the emerging of database systems, data was manually

stored and managed using file processing system.

❖A file system is a method for storing and organizing

computer files and the data they contain to make it easy to

find and access them.

❖File systems may use a storage device such as a hard disk or

CD-ROM and involve maintaining the physical location of

the files.

Introduction to database system

❖Each file is placed in relevant folders for the ease of access. ❖The filing system works well when the number of items to be stored is small. However, the manual filing system breaks down when we have to cross-reference or process and manage relationship among information in the files. This therefore explains the need for database management Systems(DBMS).

Some general functions of a DBMS

  • Designed to allow the definition, creation, querying, update, and administration of databases
  • Define rules to validate the data and relieve users of framing programs for data maintenance
  • Convert an existing database, or archive a large and growing one

Some general functions of a DBMS

  • Run business applications, which perform the tasks of managing business processes, interacting with end-users and other applications, to capture and analyze data

DBMS over File System

❖Privacy: Limited access means privacy of data. ❖Easy recovery: Since database systems keeps the backup of data, it is easier to do a full recovery of data in case of a failure. ❖Data Security: It is easier to apply access constraints in database systems so that only authorized user is able to access the data. Each user has a different set of access thus data is secured from the issues such as identity theft, data leaks and misuse of data.

Components of Database environment ❖Hardware, Consists of a set of physical electronic devices such as computers, I/O devices, storage devices, etc., this provides the interface between computers and the real world systems. ❖Software, This is the set of programs used to control and manage the overall database. This includes the DBMS software itself, the Operating System, the network software being used to share the data among users, and the application programs used to access data in the DBMS.

Components of Database environment ❖People, these includes Database Administrators, Application Programmer or Software Developer, End User. Database Administrator Application Developer End User

Data Modeling: The Entity-Relationship Diagram ❖An entity relationship model, also called an entity- relationship (ER) diagram, is a graphical representation of entities and their relationships to each other, Typically used organization of data within database. ❖An entity is any object in the system that we want to model and store information about. ❖Examples of entities are Employee, Student, Lecturer, Department, Branch. An entity is similar to a table in the relational model.

Relationships Between Entities

One-to-One

  • One instance of an entity (A) is associated with one other instance of another entity (B).
  • For example, in a database of employees, each employee name (A) is associated with only one social security number (B).

Relationships Between Entities

One-to-Many

  • One instance of an entity (A) is associated with zero, one or many instances of another entity (B), but for one instance of entity B there is only one instance of entity A.
  • For example, for a company with all employees working in one building, the building name (A) is associated with many different employees (B), but those employees all share the same singular association with entity A.

Relationships Between Entities

Many-to-Many

  • For example, for a company in which all of its employees work on multiple projects, each instance of an employee (A) is associated with many instances of a project (B), and at the same time, each instance of a project (B) has multiple employees (A) associated with it.

Relationships Between Entities ❖Cardinality refers to the maximum number of times an instance in one entity can relate to instances of another entity. ❖Cardinality: Denotes the maximum number of possible relationship occurrences in which a certain entity can participate in (in simple terms: at most).