You are on page 1of 53

INTRODUCTION TO

DATABASES
What is Database?

 A Database is a shared collection of logically related data and a description of


this data, designed to meet the information needs of an organization.
Logically related data comprises of entities, attributes and relationships of an
organization’s information.
 System catalog (metadata) is the data about the data. It provides description
of data to enable program-data independence.
 A Database Management System (DBMS) is a software tool package that
helps to manage data storage, access and maintenances. For example, MS
Access, SQLite, Oracle, MySQL, MS SQL etc.
 A Database Application is an application built upon the data stored in
databases. For example, website, Business Intelligence (BI) application,
mobile application, desktop standalone application.
File-Based Systems
 This is a collection of application programs that perform services for the end
users (e.g. reports).
 Each program defines and manages its own data.
 This typical file-processing system is supported by a conventional operating
system. The system stores permanent records in various files, and it needs
different application programs to extract records from, and add records to,
the appropriate files. Before database management systems (DBMSs) were
introduced, organizations usually stored information in such systems.
Limitations of File-Based Approach
 Separation and isolation of data.
 Each program maintains its own data.
 Users of one program may be unaware of potentially useful data held by other programs.
 Duplication of data.
 Same data is held by different programs.
 Wasted space and potentially different values and/or different formats for the same item.
 Data dependence
 File structure is defined in the program code.
 Incompatible file formats.
 Programs are written in different languages, and so cannot easily access each other’s files.
 Fixed Queries/Proliferation of application programs.
 Programs are written to satisfy particular functions.
 Any new requirement needs a new program.
Limitations of File-Based Approach

 Difficulty in accessing data. Suppose that one of the university clerks needs
to find out the names of all students who live within a particular postal-code
area. The clerk asks the data-processing department to generate such a list.
Because the designers of the original system did not anticipate this request,
there is no application program on hand to meet it. There is, however, an
application program to generate the list of all students.
Limitations of File-Based Approach

 Data redundancy and inconsistence. Since different programmers create the


files and application programs over a long period, the various files are likely
to have different structures and the programs may be written in several
programming languages. Moreover, the same information may be duplicated
in several places (files). For example, if a student has a double major (say,
music and mathematics) the address and telephone number of that student
may appear in a file that consists of student records of students in the Music
department and in a file that consists of student records of students in the
Mathematics department.
Limitations of File-Based Approach

 Security problems. Not every user of the database system should be able to
access all the data. For example, in a university, payroll personnel need to
see only that part of the database that has financial information. They do not
need access to information about academic records. But, since application
programs are added to the file-processing system in an ad hoc manner,
enforcing such security constraints is difficult.

 These difficulties, among others, prompted the development of database


systems.
Database Approach

 In this approach, definition of data was embedded in application programs,


rather than being stored separately and independently.
 There is no control over access and manipulation of data beyond that imposed
by the application programs.
 Data: Facts, figures, statistics having no particular meaning.
 Record: Collection of related data items

Roll Name Age


1 ABC 19
Database

 Table or Relation – A collection of related records.

 The columns of this relation are called Fields, Attributes or Domains. The rows are
called Tuples or Records.
Advantages of DBMS

 Controlling of Redundancy: Data redundancy refers to the duplication of data (i.e. storing
same data multiple times). In a database system, by having a centralized database and
centralized control of data by the DBA the unnecessary duplication of data is avoided. It also
eliminates the extra time for processing the large volume of data. It results in saving the
storage space.
 Improved Data Sharing: DBMS allows a user to share the data in any number of application
programs.
 Data Integrity: Integrity means that the data in the database is accurate. Centralized control
of the data helps in permitting the administrator to define integrity constraints to the data in
the database. For example: in customer database we can enforce an integrity that it must
accept the customer only from Noida and Meerut city.
Advantages of DBMS

 Security: Having complete authority over the operational data, enables the
DBA in ensuring that the only mean of access to the database is through
proper channels. The DBA can define authorization checks to be carried out
whenever access to sensitive data is attempted.
 Data Consistency: By eliminating data redundancy, we greatly reduce the
opportunities for inconsistency. For example: is a customer address is stored
only once, we cannot have disagreement on the stored values. Also updating
data values is greatly simplified when each value is stored in one place only.
Finally, we avoid the wasted storage that results from redundant data
storage.
 Efficient Data Access: In a database system, the data is managed by the
DBMS and all access to the data is through the DBMS providing a key to
effective data processing
Advantages of DBMS

 Enforcements of Standards: With the centralized of data, DBA can establish


and enforce the data standards which may include the naming conventions,
data quality standards etc.
 Data Independence: Ina database system, the database management system
provides the interface between the application programs and the data. When
changes are made to the data representation, the meta data obtained by the
DBMS is changed but the DBMS is continues to provide the data to application
program in the previously used way. The DBMs handles the task of
transformation of data wherever necessary.
 Reduced Application Development and Maintenance Time: DBMS supports
many important functions that are common to many applications, accessing
data stored in the DBMS, which facilitates the quick development of
application.
Disadvantages of DBMS

 It is bit complex. Since it supports multiple functionality to give the user the
best, the underlying software has become complex. The designers and
developers should have thorough knowledge about the software to get the
most out of it.
 Because of its complexity and functionality, it uses large amount of memory.
It also needs large memory to run efficiently.
 DBMS system works on the centralized system, i.e.; all the users from all over
the world access this database. Hence any failure of the DBMS, will impact all
the users.
 DBMS is generalized software, i.e.; it is written work on the entire systems
rather specific one. Hence some of the application will run slow.
Database Management System and its
Applications
 A Database management system is a computerized record-keeping system. It
is a repository or a container for collection of computerized data files. The
overall purpose of DBMS is to allow he users to define, store, retrieve and
update the information contained in the database on demand. Information
can be anything that is of significance to an individual or organization.
DBMS

 Databases touch all aspects of our lives. Some of the major areas of
application are as follows:
1. Banking
2. Airlines
3. Universities
4. Manufacturing and selling
5. Human resources
Enterprise Information

 Sales: For customer, product, and purchase information.


 Accounting: For payments, receipts, account balances, assets and other
accounting information.
 Human resources: For information about employees, salaries, payroll taxes,
and benefits, and for generation of paychecks.
 Manufacturing: For management of the supply chain and for tracking
production of items in factories, inventories of items in warehouses and
stores, and orders for items
 Online retailers: For sales data noted above plus online order tracking,
generation of recommendation lists, and maintenance of online product
evaluations.
Banking and Finance

 Banking: For customer information, accounts, loans, and banking transactions. ◦


 Credit card transactions: For purchases on credit cards and generation of monthly
statements.
 Finance: For storing information about holdings, sales, and purchases of financial
instruments such as stocks and bonds; also for storing real-time market data to
enable online trading by customers and automated trading by the firm.
 Universities: For student information, course registrations, and grades (in addition
to standard enterprise information such as human resources and accounting).
 Airlines: For reservations and schedule information. Airlines were among the first
to use databases in a geographically distributed manner.
 Telecommunication: For keeping records of calls made, generating monthly bills,
maintaining balances on prepaid calling cards, and storing information about the
communication networks.
Characteristics of database approach

Single repository of data


 sharable by multiple users, hence favorable for concurrency control
Self-describing
 System catalogue contains metadata (data defining other data).
 Catalogue contain information about the definitions of the database objects (for example, tables,
views)and security information about the type of access that users have to these objects.
Multiple views of data - to support individual needs of users.
Program-data independence
 Data independence is the notion of keeping data separate from all programs that make use of the
data.
 Data independence ensures that the data cannot be redefined or
reorganized by any of the programs that make use of the data.
 In this approach, the data remains accessible, but is also stable and
cannot be corrupted by the applications using it.
 It refers to the immunity of user applications to make changes in the definition and organization of
data
Conditions that may lead not to use
databases
These include
When the speed of the application is critical.
Short lifespan of the application.
In case of small data which can be manipulated using
other means
Existence of a real-time constraint for the availability of
the application.
Database languages

Data definition language (DDL)


 Permits specification of data types, structures and any data constraints that should be
part of the database.
 All specifications are stored in the database.

Data manipulation language (DML)


 Enables those with access to the database to insert, update, delete and retrieve data from
it.
 Standard Query Language (SQL) is an example of a DML
Types of DBMS

 DBMS can be classified as single-user or multi-user DBMS


 Single user DBMS – This supports only one user at a time. In case one user is using the
database, the other can not use it at the same time.
 Multi user DBMS – This supports many users at the same time. It can be used
throughout an organization by different departments at the same time.
Components of DBMS
DBMS

 Hardware: refers to the physical parts of a computer and related


devices. Can range from a PC to a network devices of computers.
 Software: collection of programs used by the computers within the
database system. DBMS, operating system, network software.
 Procedures: Instructions and rules that should be applied to the
design and use of the database and DBMS. These may consist
instructions on how to:
 Log onto the DBMS, Start and Stop DBMS, make backup copies
DBMS

 People: Users of the database system e.g. database designers, DBAs, application
programmers, and end-users.

 Data: Data acts the bridge between the machine and human components. The database
contains both operational and meta data (data about data).
Roles/Users in the Database Environment

Data Administrator (DA): Responsible over the data policies in the organization.
Does not need to be a technical person.

 Data administrator's duties include:


 Database planning,
 Development and Maintenance of standards, policies
 Taking part in the conceptual design of the database
Roles/Users in the Database Environment

Database Administrator (DBA) also known as DBA’s Responsible for the management
and control of the database. More technically oriented than the DA

 Database administrator's duties include:


 Granting user authority to access the database.
 Specifying integrity constraints.
 Monitoring performance and responding to changes in requirements.
Roles/Users in the Database Environment

Database Designers ( Logical and Physical)


 Logical database designer: concerned with identifying data ( the attributes, entities,
relationships between the data).

 Physical database designer: designs any security measures required on the data. Selecting
specific storage structures,(Swap-space management) and access methods for data to achieve
good.
Roles/Users in the Database Environment

Application Programmers: Write programs for accessing and interacting with the
database through DML calls such as data retrieval, data update, data insertion and data
deletion.

End Users (naive and sophisticated): participate in data entry of data and manipulation.
 Naive Users: do not know any thing about the database e.g. checkout assistant at a local
supermarket.

 Sophisticated users: have knowledge of how the database runs


e.g. Systems administrator
Functions of a database management
system
 It is used for storing data, retrieving data and updating data.
 It is used to control user access to data.
 It is used for transaction support.
 It is used in the concurrency control services.
 It is used in recovery services.
 It supports data communication.
 It supports integrity/ reliable services.
 It has services to promote data independence.
Database Architecture

 Database Architecture is layout of the various components of a database


system and the connections among them.
 The architecture of a database system is greatly influenced by the underlying
computer system on which the database system runs. Database systems can
be centralized, or client-server, where one server machine executes work on
behalf of multiple client machines.
Database Architecture

A Database Architecture is a representation of DBMS design. It helps to design,


develop, implement, and maintain the database management system.
A DBMS architecture allows dividing the database system into individual
components that can be independently modified, changed, replaced, and
altered. It also helps to understand the components of a database.
Types of DBMS Architecture

There are mainly three types of DBMS architecture:


 One Tier Architecture (Single Tier Architecture)
 Two Tier Architecture
 Three Tier Architecture
1-Tier Architecture

In this architecture, the database is directly available to the user. It means the
user can directly sit on the DBMS and uses it.
Any changes done here will directly be done on the database itself. It doesn't
provide a handy tool for end users.
The 1-Tier architecture is used for development of the local application,
where programmers can directly communicate with the database for the
quick response.
2-Tier Architecture

The 2-Tier architecture is same as basic client-server. In the two-tier


architecture, applications on the client end can directly communicate with
the database at the server side. For this interaction, API's
like: ODBC, JDBC are used.
The user interfaces and application programs are run on the client-side.
The server side is responsible to provide the functionalities like: query processing
and transaction management.
To communicate with the DBMS, client-side application establishes a connection
with the server side.
2-Tier Architecture
3-Tier Architecture

The 3-Tier architecture contains another layer between the client and server. In
this architecture, client can't directly communicate with the server.
The application on the client-end interacts with an application server which
further communicates with the database system.
End user has no idea about the existence of the database beyond the
application server. The database also has no idea about any other user beyond
the application.
The 3-Tier architecture is used in case of large web application.
3-Tier Architecture
Guidelines for Designing Database

A database management system can be a useful tool, but only if you


first carefully design the database so that it meets the needs of its
users. In database design, you determine the fields, tables, and relationships
needed to satisfy the data and processing requirements.
Guidelines for Designing Database

When you design a database, you should follow these guidelines:


• Identify all the fields needed to produce the required
information. The company needs information about customers and orders
• Group related fields into tables. The fields relating to customers are grouped
into the Customer table, the other fields are grouped into the Order table.
• Determine each table's primary key. Recall that a primary key uniquely
identifies each record in a table. Without a primary key, selecting the exact
record you want can be a problem For other tables, two or more fields might
be needed to function as the primary key. In these cases, the primary key is
referred to as a composite key.
Guidelines for Designing Database

• Include a common field in related tables. You use the common field to
connect one table logically with another table. When you include the primary
key from one table as a field in a second table to form a relationship, the
field is called a foreign key in the second table.
• Avoid data redundancy. Data redundancy occurs when you store the same data
in more than one place. With the exception of common fields to connect
tables, you should avoid redundancy because it wastes storage space and can
cause inconsistencies.
• Determine the properties of each field. You need to identify the properties of
each field so that the DBMS knows how to store, display, and process the
field. These properties include the field's name, maximum number of
characters or digits, data type, description, valid values, and other field
characteristics.
Data types of field and field size

Before creating a database, you must know the data type of field and the field
size. The field size specifies the max number of characters or amount of data
that can be stored into the field.
What is a data type?
It is a feature in database which specifies that type of data to be held in a
given field(stored).
Common data types fields

 Text-Text or combinations of text and numbers, as well as numbers that don't require calculations,
such as phone numbers. –Up to 255 characters
 Memo-Lengthy text or combinations of text and numbers -Up to 65,535 characters.
 AutoNumber-A unique sequential (incremented by 1) number or random number assigned by
Microsoft Access whenever a new record is added to a table. AutoNumber fields can't be updated.
 Yes/No-Yes and No values are fields that contain only one of two values (Yes/No, True/False, or
On/Off).
 OLE Object-An object (such as a Microsoft Excel spreadsheet, a Microsoft Word document, graphics,
sounds, or other binary data) linked to or embedded in a Microsoft Access table. OLE-Object Linking
and Embedding
 Date/Time-Date and time values for the years 100 through 9999.
 Number-Numeric data used in mathematical calculations.
Common data types

• Integer-It refers to a data type which represents some finite subset of the
mathematical integers. An integer is specified in the program as a sequence
of digits without spaces or thousands separators, optionally prefixed with + or

• Boolean-It is a data type having two values usually denoted TRUE or FALSE /
Yes or No.
• Character-It is a unit of data that corresponds to a unit, or symbol, such as in
an alphabet written in form of a natural language.
• Floating-point number-It describes a system for representing real numbers
which supports a wide range of values.
Summary of common Data Types
Basic Database Concepts

• File /Table/Entity
A set of related records .
A database table is similar in appearance to a spreadsheet, in that data is stored in
rows and columns in a spreadsheet while data is stored in fields and records in a
database.
• Field
A single item of data common to all records
• Record
A collection of data about an individual item
• An attribute
It is part of the description of the entity. Some of the attributes of a student include
name, subject, class, age, sex e.t.c.
Basic Database Concepts

• Primary key- It is a field(combination of fields) whose value(s) uniquely


identify a record in a table.
• Relationship-Is an association between two entities.
• Null values: Means that a field can be saved without any value.
• Foreign key: It is a field(combination of fields) whose value(s) are related to
a primary key in another table.
• Data Definition Language(DDL): The language used to define objects in a
database i.e. CREATE TABLE
• Data Manipulation Language(DML): The language used to manipulate objects
in a database i.e. INSERT, UPDATE, SELECT and DELETE.
Basic Database Concepts

• Tables-In Access, data is stored in tables. A table is a set of columns and rows,
with each column referred to as a field. Each value in a field represents a
single type of data. Each row of a table is referred to as a record.
• Queries-You use queries to retrieve specific data from your database and to
answer questions about your data. For example, you can use a query to find
the names of the employees in your database who live in a particular stat
• Forms-Forms give you the ability to choose the format and arrangement of
fields. You can use a form to enter, edit, and display data.
Basic Database Concepts

 Reports-Reports organize or summarize your data so you can print it or view it onscreen. You often
use reports when you want to analyze your data or present your data to others.
 Macros-Macros give you the ability to automate tasks. You can use a macro to add functionality to a
form, report, or control.
 Modules-Like macros, modules give you the ability to automate tasks and add functionality to a form,
report, or control. Macros are created by choosing from a list of macro actions, whereas modules are
written in Visual Basic for Applications.
 Database window: the window that appears when you open a database and that is the main control
center for working with an open Access database.
 Objects Bar: contains a set of controls each of which controls one of the six major object groups in
an Access database: tables, queries, forms, reports, macros and modules.
 Groups Bar : provides a way to organize database objects into groups and provides shortcuts to those
objects to make them easily accessible.
Basic Database Concepts

 Datasheet view: shows a table’s contents as a datasheet in rows and columns.


 Field selector (column selector) : located at the top of each column in a datasheet; clicking it
selects the entire column.
 Record selector (row selector): located to the left of a row in a datasheet; clicking it selects
the entire row.
 Current record symbol: a symbol that identifies the currently selected record.
 Navigation buttons: located at the bottom of Datasheet view; provide a way to move vertically
through the records.
 Specific Record box: located between the two sets of navigation buttons in Datasheet view;
displays the current record number.
 Compacting: rearranges the data and objects in a database to make its size smaller.
Features of a (DBMS)

 Data Structuring:
Every piece of information that you can add to your database will be
organized in a kind of catalogue, so it will be easier for you to search and
update your records later on.
 Database Customization
Along with default and necessary elements (records, tables, or objects) that
compose a database's structure, there can be created custom elements that
meet specific needs of users.
Features of a (DBMS)

 Data Retrieval
Database management system accepts data input from users and stores it. Users can access the database later on
to retrieve their records as a file, printed, or viewed on the screen.
 Query Languages: A typical DBMS makes it possible to use query languages for collecting, searching, sorting,
modifying and other activities that help users manipulate their records in the database.
 Multi-user Access
DBMS provides multiple users access to all types of information stored in one and the same data store. There is
also a security feature that prevents some users from viewing and/or modifying certain data types.
 Data Integrity
All information in a database is accessible by several or more users but only one user can change the same piece
of data at a time. This capability lets prevent database corruptions and failure.
 Metadata
DBMS database management software provides a metadata library (or a data dictionary) that describes how the
database is organized and what elements (objects, related files, records, etc.) compose its structure.
Examples of Database management software include

 Lotus Approach
 Microsoft Access
 OpenOffice.org Base
 Corel Paradox
 Oracle
 Structured Query Language(SQL)
 MySQL
Examples of Databases

 School Management System


 Hospital Management System
 Inventory Management System
 Bill Management System
 Reservation Management System
 Weather forecast Management System

You might also like