Database Concepts
Database Concepts
Total Marks: 16
MCQ- 1
Fill in the blanks-05
2marks- 01
3marks-01
5 mark -01
INTRODUCTION
Data processing:
• Processing is series of actions or
operations performed on data to
generate output .
• Calculation, sorting, indexing,
accessing data, extracting part of
data, condition based operation
Data processing cycle
Data Storage :
• Data which is currently being not
required to be kept safely. This
process is known as data storage
• Primary storage : computer circuitry
temporarily stores the data until
computer RAM process the data .
• Secondary storage : Data storage is
done permanently . Stored in floppy
disk, hard disk or CD-ROM.
Data processing cycle
Communication :
• Wired and wireless communication
to input data from afar.
• Processing at remote place
• Data storage at different places.
• Data transmitted through modem.
Database terms
1. File: Large collection of related data is called a file. It’s a basic unit of
storage in computer
2. Database: Collection of logically related data organized in a way such
that it can be accessed, managed (processed) and updated.
3. Table: Collection of data elements organized in terms of rows and
columns .
Employee
EMP_ID NAME AGE SALARY
1 AAA 43 45000
2 BBB 54 60000
3 CCC 23 30000
4 DDD 19 25000
• Data integrity: Validity of data is called data integrity . This can be automatically
checked by DBMS software
• Data sharing: Data stored can shared among multiple users and application
programs. Any new application can use the stored data without having to create
any additional data or with minimal modification
Features or advantage of
database system
• Data security : DBMS provides security tools such as user codes and
passwords. This features of DBMS enables data security whenever
access attempt is made for sensitive data
• Ease of application development: DBMS handles security, data
access, data integrity. This makes development of application
software an easy task.
• Multiple user interfaces: in order to meet needs of users with
various technical knowledge DBMS provides following user interface
• Query Language
• Application program interface
• Graphical User interface – form style and menu driven
• Backup and recovery : DBMS provides facility of backup and
recovery subsystem. This system is responsible for recovery of data
from hardware and software failures
disadvantages of database system
• Danger of overload: For small simple applications database is not advisable
• Complexity: Database system adds additional complexity and requirements.
This makes the application costly.
• Qualified personnel: Professional operation of database requires trained staff.
• Costs: due to the use of database system additional hardware requirements
makes application system comparatively costly
• Lower efficiency: database system is multi user software. This feature makes it
less efficient than specialized software designed for exactly to solve one
problem.
Data independence :
• Accessing of data without interrupting the other related data in
database is known as data independence.
Logical data independence :
• Data about the database is called logical data .
• Logical data stores information regarding how data is organized in
the database
• Logical data independence is a mechanism to change the conceptual
level without changing the external view of each user group
• Ex: In a book database if a additional data item such as quantity is
added it should change external view of each user group.
Data independence :
Physical data independence :
• Physical data independence is the ability to change physical data without
changing the logical data.
• Ex : if the storage system of database is changed ( from hard disk to SSD)
should not impact on logical data or design of database. Database should
work as before,
DBMS users
• End user: People who require access to database for querying, updating and
generating reports .
• System Analyst: They determine requirement of end user especially naïve,
parametric end users and develop specification for transaction that meet these
requirements
• Application programmers: Application programmers develop the specifications
provided by system analysts into computer programs
• Database administrator (DBA) : DBA are responsible for authorized access to
database and their usage. They also responsible for acquiring required software
and hardware .
• Database designers: They are responsible for identifying the data and suitable
structure for data to be stored in database.
DATA ABSTRACTION
• Hiding the complexity of use DBMS from users is known
as data abstraction.
Disadvantages :
• Entire file must be processed even if a single record is to be accessed
• transaction have to be sorted before processing
•Data redundancy is high since same data may be stored at different
places with different keys
3. Direct/random file organization
• Data is stored in the random order at a known physical
address.
• Accessing data also uses random method with the help of
record key.
• Storage device such as magnetic disks, CD’s or DVD’s are
used
• Desired data is accessed using various methods. One basic
techniques used access data in random file organization is
“Hashing”
3. Direct/random file organization
• Hashing has two parts
1. Hashing- It generates the physical address for the new
record key
2. Conflict resolution technique- it solves the conflicts
occurred when same physical address is assigned to
multiple record keys
• Used in information retravel system like reservation of bus,
air or train tickets.
3. Direct/random file organization
Advantages :
• No index is used to store records. This saves memory space
• Any record can be directly accessed with high speed
• Concurrent processing of transactions
•On –line processing of data can be done effectively
Disadvantages :
• More complex and requires comparatively expensive devices
• implemented only in device which support random /direct access.
• separate algorithm to be written for conflict management while hashing
process
4. Indexed sequential file organization
( ISAM)
• Combines features of sequential and direct file organization
and one of the popular method
• It consists of an index file which is a sequential file arranged
using key field which has index.
• It used random access storage like magnetic disks.
• it used in applications where transaction happens
• in both sequential and random method.
• It is also called Indexed Sequential Access Method (ISAM)
4. INDEXED SEQUENTIAL FILE ORGANIZATION
( ISAM)
Advantages :
• Provides flexibility for users as it uses both sequential and random access method
• Provides quick accessing of record provided in the index file properly organized
• permits quick access of record with high activity ratio
• On –line processing of data can be done effectively
Disadvantages :
• Extra storage and processing time for the indexing is required
• Hardware and software used are relatively expensive
Architecture of database(DBMS)
• Design of a database system highly depends on its
architecture. The design can centralized or decentralized.
• DBMS architecture can be either single layer called 1-tier
or multi layer called multi-tier.
• In a multi tier architecture each tier is related but works as
independent modules where each tier can be
independently modified, altered, changed or replaced.
Architecture of database(DBMS)
1-tier Architecture
• User directly interacts with database.
• This types of systems simplest and most
direct.
• Example - using SQL commands by an
user may extract information directly from
the computer database. Any changes done
will directly reflect on DBMS system itself
Architecture of database(DBMS)
2-tier Architecture
• it’s a software architecture
• A presentation layer or a software
interface runs on a client and data layer or
data structure gets stored on a server.
• A client- an application program send a
query to server, server process the request
and sends the required details to the client
• Server may have many clients
ARCHITECTURE OF DATABASE(DBMS)
3-tier Architecture
Example
Architecture of database(DBMS)
3-tier Architecture
• Widely used architecture
• It’s a client-server architecture
• Client- it is a user computer request the server for some
service
• Server- it is high speed computer used to provide services
against the clients request
Architecture of database(DBMS)
Layers of 3-tier Architecture
1. Presentation tier
• End user interacts with this layer. User is not aware of
application and database layers
• application layer provides different views of database as per
request of user .
• All views generated are stored in the application layer.
Architecture of database(DBMS)
Layers of 3-tier Architecture
2. Application tier
• Its is called middle layer or middle tier.
• Controls the application functionality
• It takes the request from presentation layer and interacts
with the database tier. User is not aware of this layer.
Architecture of database(DBMS)
Layers of 3-tier Architecture
3. Database tier
• it contains database server where information is stored and
retrieved
• Data in the tier is independent of application servers
• It contains all relations and their constraints
Key and Types keys
• A key is defined as the column or attribute of the database table
• Keys are used to identify record in the database table
• Keys are used for efficient access of database and to avoid duplicate records
Types keys 1
2
S110
C223
AAA
BBB
PCMC
CEBA
80
90
Types keys 1
2
S110
C223
AAA
BBB
PCMC
CEBA
80
90
• Two or more keys that uniquely identifies record (tuples) in the table is called
composite key .
•A set of primary key among candidate key is called is composite key
Ex: In the above table Sl NO and REG NO identifies all the tuples(rows)uniquely.
Both are called composite Key
3. Alternate Key:
• A candidate key which is not considered as primary key currently is called
alternate key . It is called secondary key.
• In the above table if REG NO is considered as primary key then
SL NO currently can be called as an Alternate key or secondary key.
STUDENT
Types keys SL NO REG NO NAME
COURSE
5. Foreign Key: CODE
1 S110 AAA C1
• is an attribute or set of attribute that
2 C223 BBB C2
appears as non key attribute in one
3 A312 AAA C3
relation and as primary key attribute in
4 S201 CCC C1
another relation.
COURSE
• used to extract data from two tables
COURSE DURATION
•Ex : in the two tables STUDENT and CODE
NAME FEES
IN YEARS
COURSE , COURSE CODE is called as C1 SCIENCE 50,000 2 YEARS
Foreign key since it’s a non key attribute C2 COMMERCE 48,000 2 YEARS
in STUDENT but it is a primary key in the C3 ARTS 40,000 2 YEARS
table COURSE.
Database model
• Database model describes logical design of data in a database.
• It describes relationships between different entities
• Collection of conceptual tools for describing the data and
relationships
• There are three database models
• Hierarchical model
• Network Model
• Relational model
Database model
Hierarchical Model
• It uses tree structure to represent relationship among record
• Multiple entities are ordered in hierarchical order
• Entities are related in one to many relationships .
Database model
Network Model
• Introduced in late 1960s
• Data is represented by a group of records and relationships are
connected by links
• Links are association between the records
• It allows modelling of many to many relationships among the data
• Data is organised in the form of graph
Database model
Relational Model
• Proposed by E F Codd’s theoretical paper
• Each row is distinct i.e one row cannot duplicate another row for
selected key attribute
ORDINALITY
• Minimum number of times an instance in one entity can be associated with instances in
the related entity is known as ordinality.
• It specifies absolute number of relationships
• It describes relationship as either mandatory or optional
• When minimum number is zero , the relationship is called optional
• When minimum number is one or more , the relationship is called mandatory
Relational algebra
• Relational algebra is a procedural query language which performs
set of operations on relations .
• It has operators to perform queries
• Operator can be either unary or binary
• Terminologies :
1. Relation: a set of tuples
2. Tuples : a collection of attributes which describe some real
world entity
3. Attribute: a real world role played by a named domain
4. Domain: a set of atomic values
5. Set: Collection of objects which contains no duplicate
• Some operations in relational algebra are INSERT, DELETE,
MODIFY(Unary Operations). UNION, INTERSECTION, DIFFERENCE
AND CARTESIAN PRODUCT ( Binary operations)
Data warehouse
3. Reporting : Data in the data warehouse are made available for various
organization in an useful manner. Thia process is called reporting.
Components of data warehouse
4. Meta Data: Data about the data is known as meta data. It gives
information about the data in the data warehouse.