350 likes | 403 Views
DBMS Fundamentals:Introduction. What is a Database System. A Database System is essentially a computerized record-keeping system. A database-management system (DBMS) consists of a collection of interrelated data and a set of programs to access those data.
E N D
What is a Database System • A Database System is essentially a computerized record-keeping system. • A database-management system (DBMS) consists of a collection of interrelated data and a set of programs to access those data. • Database systems are designed to manage large volume of information
File Organization : Terms and Concepts • Database: Group of related files • File: Group of records of same type • Record: Group of related fields • Field: Group of words or a complete number • Byte: Group of bits that represents a single character • Bit: Smallest unit of data; binary digit (0,1) Data Hierarchy in a Computer System
Database: Introduction A Database is an electronic store of data. • It is a repository that stores information about different things and also contains relationships among those different things.
Structure of database • A Person, place, event or item is called an entity. • The facts describing an entity are known as data. • Each entity can be described by its characteristics, which are known as attributes. Eg. Student identification number,last name, first name,phonenumber,gender and so on. • All the related entities are collected together to form an entity set. • A database is collection of entity sets. • The entities in a databse are likely to interact with other entities. The interactions between the entity sets are called relationships.
Relationships E2 E1 One-to-One 1:1 E2 One-to-Many E1 1:M Many-to-Many E2 E1 M:N
Realtionships • One-to-one relationship • It is written as 1:1 in short form • Eg. An employee manages one department in a company, and only one employee manages a department. • One-to-many relationship • It is written as 1:M. • Eg. (i)An Employee works in a department, but a department has many employees. • (ii) A faculty teaches for one division in a college, but division has many faculty members.
(cont..) • Many-many relationship: • It is written as M:N or M:M. • Eg. (i)An employee works on many projects, and a project has many employees. • (ii) A student takes many courses, and many students take a course
Database Management System(DBMS) • A DBMS software package such as MS-Access, Visual Foxpro,MS-SQL server,Oracle. • A user developed and implemented database that includes tables, a data dictionary. • Custom applications such as data-entry forms,reports,queries,blocksand programs. • Computer hardware: Personal computers, mini computers and mainframes in a network environment. • Software: An operating system and a N/W OS. • Personnel: A database administrator, a database designer/analyst, a programmer and end users.
Fig: Database System User Applications DBMS Database OS Software Hardware
Important functions • The data dictionary is a system structure that stores metadata(data about data). • It manages all day-to-day transactions. • It secures access through passwords, encryption and restricted user rights. • It provides backup and recovery procedures for physical security of data. • It allows users to share data with data-locking capabilities. • It provides import and export utilities. • It allows users to specify validation rules.
Relational Database Model • Represents data as two-dimensional tables called relations • Relates data across tables based on common data element Examples: DB2, Oracle, MS SQL Server
Relational database Model • A row is referred to as a tuple. • A Key is a minimal set of columns used to uniquely define any row in a table. • A single column is used as unique identifier, it is known as primary key. • A column in a table that references a column in another table is known as foreign key.
Relational database Model • PROJ2017 • PROJ2018
PRJPARTS • PARTS
DEPARTMENT • EMPLOYEE
Notation used for tables • PROJ2017(ProjNo,Location,customer) • PROJ2018(ProjNo,Location,customer) • PRJPARTS(ProjNo,PartNo,Qty) • PARTS(PartNo,PartDesc,Vendor,Cost) • DEPARTMENT(DeptNo,DeptName) • EMPLOYEE(EmpNo,Ename,DeptNo,ProjNo,Salary)
Integrity Rules • Entity Integrity: • No column in a primary key may be null. • A Null value means a value that is not known, not entered, not defined, or not applicable. • Referential Integrity: • A foreign key value may be a null value, or it must exist as a value of primary key in the referenced table.
Theoretical Relational Languages • Relational Algebra: A Procedural language • Union • Intersection • Difference • Projection • Selection • Product • Assignment • Join • Division • Relational Calculus: A nonprocedural language
Union TABLE_A=PROJ2017 U PROJ2018 TABLE_A
Intersection TABLE_B=PROJ2017 ∩ PROJ2018 TABLE_B
Difference TABLE_C=PROJ2017 - PROJ2018 TABLE_C TABLE_D=PROJ2018 - PROJ2017 TABLE_D
Projection • TABLE_E=PARTS(PartDesc, Cost) Selection • TABLE_F=Sel(PARTS:Cost>10.00)
Product • If the first table has x rows and the second table has y rows, the resulting product has x*y rows. • If the first table has m columns and the second table has n columns, the resulting product has m+n columns. DEPARTMENTEMPLOYEE TABLE_G=EMPLOYEE*DEPARTMENT 2 * 3=6 rows 1 + 1=columns
Assignment • Assignment(=) gives us an ability to name new tables that are based other tables. • Eg: TABLE_A=PROJ2017 U PROJ2018 TABLE_C=PROJ2017 - PROJ2018 Join: TABLE_H=join(EMPLOYEE,DEPARTMENT:DeptNo=DeptNo)
Division: It identifies rows in one table that have a certain relationship to all rows in another table. • Let us consider the following two tables: PROJ TABLE_I=PRJPARTS/PROJ PROJPARTS
Database Design:Data Modeling and Normalization Data Modeling • The Entity-Relationship (E-R) model is a very popular modeling tool among many such tools available today. • The E-R model uses E-R diagrams(ERD) for graphical representation of the database components. • An entity (or an entity set) is represented by rectangle. The name of the entity(set) is written within the rectangle.
A line represents relationship between the two entities. • The name of the relationship is an active verb in lowercase letters. • For Eg: works, manages, employs EMPLOYEE