1. Introduction to Database Systems Topics: 1. What is a database ? 2. Database Management System (DBMS) 3. Database Vs DBMS 4. File Managers Vs. DBMS 5. Data Models & Kinds of DBMSs 6. Database Languages 7. History of Database Systems
1. Introduction to Database Systems
Topics:
1. What is a database ?
2. Database Management System (DBMS)
3. Database Vs DBMS
4. File Managers Vs. DBMS
5. Data Models & Kinds of DBMSs
6. Database Languages
7. History of Database Systems
What is a Database ?
A database is a collection of data.
Example databases:
Attendance Register (at office reception)
Bank Accounts (in a bank)
A scroll of shopping list (in your pocket)
ColorNote Data (in your smart phone)
A bunch of resumes (on HR manager's table)
Contact list (in your smart phone)
Attendance Register is a Database
An attendance register contains at least one record for each employee.
An employee is typically expected to write a serial number, his/her name, time of entry into the office, time of exit from the office, entry-time signature and exit-time signature. One may also write purpose of entry during non-office hours and so on. The register contains multiple record entries for each day. It is essentially a collection of records or data and hence it is a database. The database is not computerized but it is maintained manually. In any case, it is a database.
A Scroll of Shopping List is a Database
Most of you must be noting list of items you need to bring from a shop or market.
For example, the list may contain items such as “1 kg Sugar, one tooth paste, two soaps,...”. This list that you may have noted on a paper is nothing but collection of data. Hence, it is a database but not in a computer. Each data item here contains name of shopping item, weight (e.g., “1 kg”) or a number (e.g., “two”) depending on the type of item.
A Bunch of Resumes is a Database
Many resumes may be lying on the table of your HR manager!
The collection of resumes is nothing but a database. Of course some may be lying on the table of the HR manager, some may be in a cup-board and yet some may be in inbox of email client program the manager uses. Each resume contains data items such as name of candidate, date of birth, qualifications, experience, etc. All these resumes can be treated as manually maintained database.
Bank Accounts in a bank is a Database
Account data maintained by bank for its customers is a database. It is a collection of data of all customers.
Banks may maintain variety of data for each customer. Not only simple and mandatory data such as name, account number and balance, banks may maintain data such as fixed deposit amount, rate of interest, amount of loan given, etc. All this data is part of the database. Nowadays all most all banks store the data in computers managed by specialized software (we are going to talk about such software later in great detail)
ColorNote notes is a Database
ColorNote is a software that runs on Android devices such as mobile phones. You can create various notes you want to remember and save them so that you can refer to them in future. For example, I use ColorNote for storing information on my bank account details, passport details, income tax details, etc., so that I can refer to them while filling various forms. All these notes, a collection of data, is nothing but a database.
Contact List is a Database
List of names persons along with their phone numbers and/or email IDs and other related data you store in your mobile phone, tablet or on your PC is also a database.
Recapitulation
Database is a collection of data.
There are manually maintained databases and computerized databases.
An example for manually maintained database is attendance register.
An example for computerized database is bank account data.
What is a Database Management System?
A database management system is a software used to create,
query, manipulate and control databases.
Short name for database management system is DBMS.
Database Management System Environment
DBMS
Database
Application
Database Database
Application Application Application
Database Creation
The creation of a database usually involves specification of a name for the database and other parameters.
Database Querying
Querying means retrieving required data from the database.
For example, you may want to retrieve “name and account number of customers” from the database.
Required means based on conditions such as “balance > $5000”.
Database Manipulation
Manipulation means
adding new data to the database
modifying existing data in the database or
deleting existing data from the database
Database Control
Control means
limiting access to data only to authorized users
sharing data among the users in such a way that database integrity is maintained
DBMS Components
Database Server
ODBC Driver
JDBC Driver
.NET Data Provider ISQL LOAD DUMP SCHEMA
REPORT
BACKUP
RESTORE
ESQL / C
ESQL / Java
MONITOR
Communication Network
Ap
plic
atio
n D
eve
lop
me
nt In
terf
ace
s
Adhoc query and manipulation tool
databases
Database Vs DBMS
A database is a collection of data.
A database usually consists of data in
one or more files on one or more disks
of a computer or it may be distributed
across multiple computers.
Database is not a software.
Database Vs DBMS
DBMS on the other hand is a software.
DBMS is used to manage databases.
DBMS usually consists of one or more
programs (executables and libraries)
written in programming languages such
as C, C++ and Java.
Database Vs DBMS
Database != DBMS
File Managers Vs DBMS
Some File managers or Storage
Managers / systems:
C-ISAM (Informix,IBM)
ObjecTrieve (Cosoft)
C-Tree (Faircom)
BerkeleyDB (Oracle)
File Managers Vs DBMS SNO Functionality File Manager DBMS
1 Retrieval of data that is a combination of data from multiple types of records
Lot of programming effort is required
Very easy to retrieve such data
2 Data security Application has to build from scratch
Basic security definition capability is built into the DBMS.
3 Changes in record structure or data types
Big impact on applications
The impact is minimal
4 Performance tuning Difficult to tune once database structure is frozen.
Tuning is much lot easier
5 Application portability Not portable Higher level DBMS APIs make applications portable across DBMSs from different vendors
6 Programming productivity
Low as the APIs are low level.
High.
Data Models & DBMSs
Data Models & DBMSs
Data model: Structure + Operations
Structure: Record structures, field data
types, lengths, keys, etc.
Operations: Retrieval, Addition,
Modification, Deletion, etc.
Categories of Data Models
Object-based Data Models
Record-based Data Models
Physical Data Models
Data Models Used by DBMSs
Main data models used by most of the
DBMS are as follows:
Network Data Model
Hierarchical Data Model
Relational Data Model
Object-Oriented Data Model
Other Data Models
Entity-Relationship Data Model
Network Data Model
Network Data Model
Introduced in the conference on Data and
Systems Language (CODASYL) in 1971.
Main Concepts: – Record Types
– Data Items
– Links
Network Data Model Database
•Database consists of records of one or more
Record Types.
•A record type defines structure of records;
number of data items and data types of items.
•Data Items are fields of record types.
•Links represent relation-ships between record
types.
Network Data Model Record Type
Record Type:
Represents structure of records to be
stored in the database.
Examples:
Item, Customer, Vendor, Employee,
Department and Project.
Network Data Model Data Items
Data items are fields of record type.
Examples:
Employee record type data items:
- eno // Employee number
- ename // Empoyee name
- dno // Employee dept. number
… Department record type data items: - dno // Department number - dname // Department name. …
Network Data Model Links
Links represent relationships between record types.
Graphically each record type is represented using a rectangle
with name of the record type inside it.
Links are represented by drawing an arc from one record type
to another as shown below:
Employee
Department
consists-of
The relationship name of the link is consists-of. One way to read the diagram is as follows: A Department consist of Employees.
Network Data Model Link/Relationship Types
Relationships in this model can be of two types : Binary type or
Many to one
Employee Department Employee Resume
Binary relationship Many-to-one relationship
Logical Structure of Network Data Model Database
The logical structure is represented by one or more record
types and links between them.
Each many-to-many relationship is broken into two many-to-
one relationship.
Logical structure of an example database is as follows:
Employee
Resume
is-submitted-by
Department
works-in
EmpProj Project executes executed-by
Record Type EmpProj is a dummy record type used to resolve many-to-may relationship between Employee and Project record type.
Network Data Model Based Database Management Systems
The most widely used Network DBMS is IDMS/R from
Computer Associates.
Another system is ADMIN from CMC Ltd.
Hierarchical Data Model
Hierarchical Data Model
Data is in collections of records.
Relationships are represented as sets.
A restricted type of Network Data Model.
Each Record Type can have only one Parent and thus hierarchy.
Model can be represented as a tree graph.
Record Types are nodes of the graph.
Links are edges in the graph.
Logical Structure of Hierarchical Data Model Database
Employee
Resume
Department
Project
Hierarchical Data Model Based Database Management Systems
•There are not many hierarchical database systems.
•The most widely used hierarchical database management systems is IMS (Information Management System) from IBM.
Relational Data Model
Relational Data Model
Has strong mathematical foundations
Based on the concept of mathematical relations
Data and relationships are represented using tables.
Data items are represented as columns of tables.
A relational data model based database consists of one or more tables.
Databases based on relation data model are called Relational Databases.
The data model is only a logical model. Physical data model of a DBMS could be same or different.
Logical Structure Relational Data Database
Employees Eno Ename Dno
Resumes Eno ResumeText
Departments Dname Dno Mno Projects
Pno Pname Eno Pmgr
The sample database consists of the following four tables:
Names of the columns are given below each table name.
Relational Data Database With Sample Data
Table: Employees
Table: Resumes
Table: Departments
Table: Projects
dno dname mno
1 R & D 1001
2 Marketing 1002
3 Admin 1004
eno ename eno
1001 Bhaskar 1
1002 Dinesh 2
1003 Sagar 1
1004 Harish 3
1005 Bose 1
1006 Praveen 1
eno resume_text
1001 ....
1002 ....
1003 ....
1004 ...
1005 ...
1006 ...
pno pname mno
101 LifeStyle 1005
201 ScoreWell 1003
Relational Database Terminology
General Academic
Table Relation
Column Attribute
Row Tuple
There are two kinds of terms used to refer to the same concept. Most popular are general terms compared to academic terms.:
Relational Database Management System Products
There are many relational database management systems – paid ones as well as free ones. Here are the most used relational DBMSs or RDBMSs: Oracle Database (from Oracle) MS SQL Server (from Microsoft) DB2 (from IBM) SyBase (from SAP) C-treeACE(from Faircom) MySQL (from Oracle) PostgreSQL (free) SQLite (free)
Database Languages
What you will learn from this session:
Purpose of database languages
Usage Scenarios
Components of a Database language
Database Languages
SQL - Structured Query Language
Database Languages
Database Languages Purpose
The purpose of a data language is
to communicate with DBMS to retrieve data from the database,
add data to the database, modify data in the database or delete data from the database.
Database Languages Usage Scenario -Tools
DBMS
Databases
Database Language commands
ISQL tool Results
(mysql/sqlcmd/sqlite/ sqlplus/isql/…)
Database Languages MySQL Command-Line Tool
Database Languages Usage Scenario - Applications
DBMS
Databases
Database Language
Application Results
Database Language Components
A database language consists of essentially three components each serving a specific purpose. These are as follows: Data Definition Language (DDL)
Data Manipulation Language (DML)
Data Control Language (DCL)
These languages are called data sub-languages because they do not have all constructs required for writing general programs that can be written using languages such as C, C++ and Java.
Data Definition Language (DDL)
DDL is used to define database structure. It contains various statements to define structures to hold data of specific record types or object types, relationships among them and any integrity constraints the data has to satisfy. An example DDL statement in SQL is as follows:
CREATE TABLE customers(id INTEGER, name
VARCHAR(50), address VARCHAR(200));
This statement creates a structure for a table called customers which has columns id, name and address for an RDBMS database.
Data Manipulation Language (DML)
DML is used to retrieve data from the database, add data to the database, modify existing data in the database or delete data from the database. The part of DML used to retrieve data is called Query language. An example DML statement for adding data is as follows:
INSERT INTO customers VALUES(1, 'Akhil', '305, 2nd C
Main Road, 8th Block, Koramangala, Bangalore - 560095');
Note! Terms DML and Query language are used interchangeably.
Data Control Language (DCL)
DCL is used to control access to data. Controlling data access primarily involves giving privileges to users to access data items, or taking away privileges from the users who do not need them and transaction management. An example for giving privilege on a table to a user in SQL is as follows:
GRANT SELECT ON customers TO praveen;
Database Languages
There are not many languages proposed as such unlike
regular programming languages. Some of the languages
implemented by database products are as follows:
SQL – Structured Query Language
QUEL – Query Language
QBE – Query By Example
Database Languages Structured Query Language (SQL)
Structured Query Language or SQL is the most widely
implemented and used language for relational database
management systems.
SQL covers DDL, DML and DCL. There is an international standard for the language. Defined by D.Chamberlin of IBM in 1974 as SEQUEL (Structured English Query Language). A revised version called SEQUEL/2 was defined in 1976 and the name was changed to SQL for legal reasons.
Database Languages Query Language - QUEL
QUEL is the query of language of relational database management systems INGRES and SPREADS. QUEL was overshadowed by SQL and hence its user base is almost nil. An example query is: RANGE OF e IS employees RETRIEVE (e.ename) WHERE e.salary > 5000
Database Languages Query By Example (QBE)
QBE is one of the first graphical user interfaces.
Developed by IBM and is available as part of QMF (Query
management Facility) interface of DB2.
QBE is available for Microsoft Access DBMS as well. No rigid syntax, no need to remember table names and column names. QBE can be used for data definition as well.
History of
Database Systems
History of Database Systems
SNO YEAR Historical Information
1 1961 Bachman introduced the concept of record and set types. Database Task Group (DBTG) used the concept to develop CODASYL Network Data Model.
2 1964 The first DBMS called Integrated Data Store was designed by Backman for GE.
3 1965-70 IBM introduced Hierarchical Model and developed DBMS called Information Management System (IMS). Commerical DBMSs emerged: IDMS (Computer Associates), IDS II (Honeywell), DMS 1100 (UNIVAC's), DMS-170 (CDC), DBMS-11 (DEC) and PHOLAS (Phillips)
4 1970 Relational Data Model was introduced by Ted Codd of IBM.
5 1971-76 Many research activities were initiated in the area of database systems. Chen introduced E-R Model.
History of Database Systems
SNO YEAR Historical Information
6 1976 RDBMSs developed: System R (IBM), INGRES (Univ. of California, Berkeley), System 2000 (Univ. of Texas, Austin), ADABAS (Tech. Univ. of Darmstadt), DB2 and SQL/DS (IBM), Oracle (Oracle Corp) Query Languages developed: ISBL, SQUARE, SEQUEL, QBE, QUEL, SQL, ...
7 1984 - DBMSs were enhanced with various tools for report generation, graphical diagrams, etc. Indian companies also came with relational database managements systems SPREADS (CMC), ADMIN (CMC), Integra4 (COSOFT) and Dharma/SQL Access (Dharma Systems).