Professional Documents
Culture Documents
Unit 1: Basics of Databases
Unit 1: Basics of Databases
Unit 1
Basics of databases
Data: Anything can be data. Ex- number, name, person, city, etc.
Information: Meaningful data is called the information.
Database: Database is an organized collection of related information.
The database can be use for
Retrieving the desired information
Taking meaningful decision
Recognizing information
Processing information
Ex: Telephone Directory, Dictionary, Sales department details
Database can handle business inventory, accounting filling and use that
information to prepare summaries, estimates and reports.
Typical Database operations are Adding, Modifying, Arranging and Removing
information.
The Management of data in database system is done by means of a general
purpose software package called DBMS.
Some commercial available DBMS are Excel, ORACLE, SQL Server and MS-Access.
Database File
Database file is the collection of related records.
Record
The physical representation of entity set is made by aggregating the attributes to model
the entity set, such a representation is called Record.
Fields
In DBMS a column under which the information in the record are stored is called the field.
It is a software system that allows users to define, create maintain a database and
provides controlled access to the data. DBMS is basically a collection of programs that
enables users to store, modify and extract information from a database as per the
requirements. DBMS is an intermediate layer between programs and the data.
The following are the main examples of database applications:
Page 1
Dharmesh Solanki
Advantages of DBMS
Reduction of Redundancies
Improved Data Consistency
Improved Data Sharing
Integrity
Security
Conflict Resolution
Data Independency
Disadvantages of DBMS
1. INTERNAL VIEW
2. CONCEPTUAL VIEW
3. EXTERNAL VIEW
Page 2
Dharmesh Solanki
1. INTERNAL VIEW :
In this view at the lowest level of abstraction, closet to the physical storage
methods used. It indicates how data will be stored and describes the data
structures and access method to be used by the database. The internal view is
expressed by the internal view schema, which contains the definition of the stored
record, the method of representing the data fields, and the access of it.
Components of DBMS
Naïve Users: These are the users who use the existing application to interact with the
database. For example, online library system, ticket booking systems, ATMs etc which has
existing application and users use them to interact with the database to fulfill their
requests.
Online Users: These are users who may communicate with the database directly via an
online terminal or indirectly via a user interface and application program. These users are
aware of the presence of the database system and may have acquired a certain amount of
expertise in the limited interaction they are permitted with the database through the
application program.
Application Programmers: As its name shows, application programmers are the one who
writes application programs that uses the database. These application programs are
Page 3
Dharmesh Solanki
written in programming languages like C, C++, Java and fourth generation language. These
programs meet the user requirement and made according to user requirements.
Retrieving information, creating new information and changing existing information is
done by these application programs.
Database Administrator: One of the main reasons for using DBMSs is to have central
control of both the data and the programs that access those data. A person who has such
central control over the system is called a database administrator (DBA). These are the
functions of a data administrator:
Page 4
Dharmesh Solanki
Structure of DBMS
OS or own File
Manager
OS Disk
Manager
Page 5
Dharmesh Solanki
3. Relational
1. Hierarchical model
2. Network Model
The popularity of the network data model coincided with the popularity of the
hierarchical data model.
Some data were more naturally modeled with more than one parent per child. So,
the network model permitted the modeling of many-to-many relationships in data.
Page 6
Dharmesh Solanki
In 1971, the Database Task Group of the Conference on Data Systems Languages
(DBTG / CODASYL) formally defined the network model. The basic data modeling
construct in the network model is the set construct.
A set consists of an owner record type, a set name, and a member record type.
A member record type can have that role in more than one set, hence the multi
parent concept is supported.
An owner record type can also be a member or owner in another set.
The data model is a simple network, and link and intersection record types (called
junction records by IDMS) may exist, as well as sets between them.
Thus, the complete network of relationships is represented by several pair wise
sets; in each set some (one) record type is owner (at the tail of the network arrow)
and one or more record types are members (at the head of the relationship
arrow).
Usually, a set defines a 1:M relationship, although 1:1 is permitted. The CODASYL
network model is based on mathematical set theory.
In above diagram we can clearly seen that entity d having multiple parents which will
display one child having multiple parents.
3. Relational Model
Page 7
Dharmesh Solanki
The resulting groups of data are organized and are much easier for many people to
understand.
For example, a data set containing all the real-estate transactions in a town can be
grouped by the year each transaction occurred, the sale price, a buyer's last name
and so on.
Such a grouping uses the relational model (a technical term for this is schema).
Hence, such a database is called a "relational database."
The software used to do this grouping is called a relational database management
system (RDBMS). The term "relational database" often refers to this type of
software
Relational database theory uses a set of mathematical terms, which are roughly
equivalent to SQL database terminology.
The table below summarizes some of the most important relational database
terms and their SQL database equivalents.
Page 8
Dharmesh Solanki
TUPLE According to the relational model , every relation or table is made of many
Tuples.They are also called row/records.
The characteristics of the tuple are reflected by its attributes or fields. This simply
means that the column contains will be defined by the attributes of that column.
Key Constraints
A Key Constraint is a statement that a certain minimal subset of the fields of a relation is a
unique identifier for a tuple.
Super Key: It is a set of one or more attributes which put together enable us to
identify uniquely an entity in the entity set.
Candidate Key: A set of fields that uniquely identifies a tuple according to a key
constraint is called a candidate key. A superkey for which no subset is called a
candidate key. (A superkey that is minimal is a candidate key ) Eg. In students
relation, sid is candidate key.
Primary Key: It is a candidate key (there may be more than one) chosen by the
database designer to identify entities in an entity set.
Page 9
Dharmesh Solanki
Foreign Key: If the primary key of one table is referenced in the other table, then
that key is called as foreign key in the another table. The foreign key in the
referencing relation must match the primary key of the referenced relation.
Alternate key: As we have seen above keys, the remaining keys are known as
alternative keys.
RELATIONSHIP
A Relationship is established between two database tables when one table has a foreign
key that references the primary key of another table.
RELATIONSHIP TYPES
One-to-one − One entity from entity set A can be associated with at most one
entity of entity set B and vice versa.
One-to-many − One entity from entity set A can be associated with more than one
entities of entity set B however an entity from entity set B, can be associated with
at most one entity.
Page 10
Dharmesh Solanki
Many-to-one − More than one entities from entity set A can be associated with at
most one entity of entity set B, however an entity from entity set B can be
associated with more than one entity from entity set A.
Many-to-many − One entity from A can be associated with more than one entity
from B and vice versa.
Page 11
Dharmesh Solanki
Page 12