0% found this document useful (0 votes)
5 views

Database basics 1

Unit 1 introduces database systems, covering data arrangement, hierarchy, and the benefits of databases in business. It discusses various file organization methods, including sequential, indexed, and hashed file organizations, along with their advantages and disadvantages. The unit also explains the components of a Database Management System (DBMS) and different database models such as relational, hierarchical, and network models.

Uploaded by

Avani Joshi
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Database basics 1

Unit 1 introduces database systems, covering data arrangement, hierarchy, and the benefits of databases in business. It discusses various file organization methods, including sequential, indexed, and hashed file organizations, along with their advantages and disadvantages. The unit also explains the components of a Database Management System (DBMS) and different database models such as relational, hierarchical, and network models.

Uploaded by

Avani Joshi
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 42

Unit 1- Introduction Database Systems

⮚ 1.1 Basic of Data Arrangement and access


⮚ 1.2 Data Hierarchy Bit, Byte (Character), Field,Record, File and
Database
⮚ 1.3 Storing and Accessing Records
⮚ 1.4 Traditional File Environment and Problems with the File
Approach
⮚ 1.4 Concepts of Database
⮚ 1.5 Benefits of Database in Business
⮚ 1.6 Database systems- components
⮚ 1.7 Hierarchical, Network and Relational Database Models
⮚ 1.8 Concept of RDBMS, Advantages of RDBMS
Basic Concept and Definition

⮚ Data :Data is raw, unorganized facts that need to be processed. Data


can be something simple and seemingly random and useless until it
is organized.
Example : Each student's test score is one piece of data.
⮚ Information: When data is processed, organized, structured or
presented in a given context so as to make it useful, it is called
information.
Example: The average score of a class or of the entire school is
information that can be derived from the given data.
Data And Information
Data are logically organized into:

1. Bits (characters)
2. Fields
3. Records
4. Files
5. Databases
1)Bit (Character) - a bit is the smallest unit of data representation
(value of a bit may be a 0 or 1).

Byte: It is a smallest addreressable unit in a computer. A byte is a set of 8


bits.
2)Field - a field consists of a grouping of characters. A data field represents
an attribute (a characteristic or quality) of some entity (object, person, place,
or event).
3)Record - a record represents a collection of attributes that describe a real-
world entity. A record consists of fields, with each field describing an
attribute of the entity.
4)File - a group of related records. Files are frequently classified by the
application for which they are primarily used (employee file).
Example of Fields & Records

Element/Field

ID Name Age Salary


1 Adam 34 13000
2 Alex 28 15000 Records
3 Stuart 20 18000
4 Ross 42 19020
What is Database ? Database
DBMS= Database + Management System

▪ A database is a shared collection of logically related data


in a systematic manner, that is stored to meet the
requirements of different users of an organisation,that
can easily be accessed, manage and updated.

▪ Database is a place where related piece of information is


stored and various operations can be performed on it.

▪ Database can be maintained manually or through


electronic devices such as: mobile phones, digital
diaries,computers etc.
File organization
🠶 File organization is a logical relationship among various
records. This method defines how file records are mapped
onto disk blocks. File organization is used to describe the way
in which the records are stored in terms of blocks, and the
blocks are placed on the storage medium.
🠶 Types of file organization:
⮚ Sequential file organization
⮚ Indexed file organization
⮚ Hashed file organization
Sequential File Organization

🠶 In sequential file organization, records are placed in the file in some


sequential order based on the unique key field or search key.
Advantages of Sequential File Organization

🠶 The design is very simple compared other file organization.


There is no much effort involved to store the data.
🠶 When there are large volumes of data, this method is very fast
and efficient. This method is helpful when most of the records
have to be accessed like calculating the grade of a student,
generating the salary slips etc where we use all the records for
our calculations.
🠶 This method is good in case of report generation or statistical
calculations.
🠶 These files can be stored in magnetic tapes which are
comparatively cheap.
Disadvantages of Sequential File Organization

🠶 identifying the record, inserting/ updating/ deleting the record, and


then sorting them always takes some time and may make system
slow.
🠶 Sorted file method always involves the effort for sorting the record.
Indexed File Organization
🠶 An indexed file contains records ordered by a record key . A
record key uniquely identifies a record and determines the
sequence in which it is accessed with respect to other records.
🠶 The first column is the Search key that contains a copy of the
primary key of the table.
🠶 The second column is the Data Reference or Pointer which
contains a set of pointers holding the address of the disk block
where that particular key value can be found.
Advantages & Disadvantages of Index File
Organization
⮚ Data can be access directly and quickly.
⮚ Data maintained centrally and it kept up-to-date.
⮚ Primary and secondary index can be used to search the data.
Disadvantages:
⮚ To insert a record in between the records is difficult.
⮚ If index values becomes too high , then searching becomes slow.
⮚ Hardware required for these system is expensive as data is stored on
disk.
⮚ Backup should be taken regularly.
Hashed File Organization

🠶 Hash File Organization uses Hash function computation on some


fields of the records. The output of the hash function determines the
location of disk block where the records are to be placed.
🠶 Ex.Hash function=key mod 10
🠶 101 mod 10=1
Hash Organization

🠶 Data bucket – Data buckets are the memory locations where the
records are stored. These buckets are also considered as Unit Of
Storage.
🠶 Hash Function – Hash function is a mapping function that maps all
the set of search keys to actual record address. Generally, hash
function uses primary key to generate the hash index – address of
the data block. Hash function can be simple mathematical function
to any complex mathematical function.
Advantages of Hash File Organization
🠶 Records need not be sorted after any of the transaction. Hence the
effort of sorting is reduced in this method.
🠶 Since block address is known by hash function, accessing any
record is very faster. Similarly updating or deleting a record is also
very quick.
🠶 This method can handle multiple transactions as each record is
independent of other. i.e. since there is no dependency on storage
location for each record, multiple records can be accessed at the
same time.
🠶 It is suitable for online transaction systems like online banking,
ticket booking system etc.
Disadvantages of Hash File Organization
🠶 Disadvantages:
🠶 The hash function can be any complex mathematical function.
🠶 This method may accidentally delete the data. For example, In Student table, when
hash field is on the STD_NAME column and there are two same names – ‘Antony’,
then same address is generated. In such case, older record will be overwritten . So
there will be data loss.
🠶 Since all the records are randomly stored, they are scattered in the memory. Hence
memory is not efficiently used.
🠶 If we are searching for range of data, then this method is not suitable. Because, each
record will be stored at random address. Hence range search will not give the correct
address range and searching will be inefficient. For example, searching the
employees with salary from 20K to 30K will be efficient.
🠶 Searching for records with exact name or value will be efficient. If the Student
name starting with ‘B’ will not be efficient as it does not give the exact name of the
student.
🠶 If these hash columns are frequently updated, then the data block address is also
changed accordingly. Each update will generate new address. This is also not
acceptable.
Traditional file-based approach
🠶 The term 'file-based approach' refers to the situation where data
is stored in one or more separate computer files defined and
managed by different application programs.
🠶 Typically, for example, the details of customers may be stored in
one file, orders in another, etc. Computer programs access the
stored files to perform the various tasks required by the
business. Each program, or sometimes a related set of programs,
is called a computer application.
🠶 For example, all of the programs associated with processing
customers' orders are referred to as the order processing
application. The file-based approach might have application
programs that deal with purchase orders, invoices, sales and
marketing, suppliers, customers, employees, and so on.
🠶 Limitations
• Data duplication: Each program stores its own separate files. If the same
data is to be accessed by different programs, then each program must store
its own copy of the same data.
• Data inconsistency: If the data is kept in different files, there could be
problems when an item of data needs updating, as it will need to be
updated in all the relevant files; if this is not done, the data will be
inconsistent, and this could lead to errors.
• Difficult to implement data security: Data is stored in different files by
different application programs. This makes it difficult and expensive to
implement organization-wide security procedures on the data.
The following diagram shows how different applications will each have their
own copy of the files they need in order to carry out the activities for which
they are responsible:
File processing Vs. DBMS
File System DBMS System

1 File system is a software that manages ad organizes the DBMS is a software for
files in a storage medium within a computer. managing the database.

2 Redundant data can be present in a file system. In DBMS there is no redundant


data.
3 It doesn’t provide backup and recovery of data if it is lost. It provides backup and
recovery of data even if it is
lost.
4 There is no efficient query processing in file system. Efficient query processing is
there in DBMS.
5 It is less complex as compared to DBMS. It has more complexity in
handling as compared to file
system
6 File systems provide less security in comparison to DBMS. DBMS has more security
mechanisms as compared to
file system.
7 It is less expensive than DBMS. It has a comparatively higher
cost than a file system.
Benefits of Database in Business

Developing a database for your business can help you:


• reduce the amount of time you spend managing data
• analyze data in a variety of ways
• promote a disciplined approach to data management
• turn disparate information into a valuable resource
• improve the quality and consistency of information
🠶 Many businesses do not have the time or resources available to gather and process
large quantities of information. This may lead to a lack of information about:
• how their business is performing
• how profitable their product lines are
• if customers are making repeat purchases
Components of DBMS
🠶 The database management system can be divided into five major
components, they are:
1. Hardware
2. Software
3. Data
4. Procedures
5. Database Access Language
Hardware
When we say Hardware, we mean computer, hard disks, I/O channels for
data, and any other physical component involved before any data is
successfully stored into the memory.
When we run Oracle or MySQL on our personal computer, then our
computer's Hard Disk, our Keyboard using which we type in all the
commands, our computer's RAM, ROM all become a part of the DBMS
hardware.
Software
⮚ This is the main component, as this is the program which controls
everything. The DBMS software is more like a wrapper around the
physical database, which provides us with an easy-to-use interface to
store, access and update data.
⮚ The DBMS software is capable of understanding the Database Access
Language and interpret it into actual database commands to execute them
on the DB.
Data
⮚ Data is that resource, for which DBMS was designed. The motive behind
the creation of DBMS was to store and utilise data.
⮚ In a typical Database, the user saved Data is present and meta data is
stored.
⮚ Metadata is data about the data. This is information stored by the DBMS
to better understand the data stored in it.
⮚ For example: When I store my Name in a database, the DBMS will store
when the name was stored in the database, what is the size of the name, is
it stored as related data to some other data, or is it independent, all this
information is metadata.
Procedures
⮚ Procedures refer to general instructions to use a database management
system. This includes procedures to setup and install a DBMS, To login
and logout of DBMS software, to manage databases, to take backups,
generating reports etc.
DBMS for execution, which is then translated and executed by the DBMS.
Database Access Language
Database Access Language is a simple language designed to write
commands to access, insert, update and delete data stored in any
database.
A user can write commands in the Database Access Language and
submit it to the
🠶 Users
• Database Administrators: Database Administrator or DBA is the one
who manages the complete database management system. DBA takes care
of the security of the DBMS, it's availability, managing the license keys,
managing user accounts and access etc.
• Application Programmer or Software Developer: This user group is
involved in developing and desiging the parts of DBMS.
• End User: These days all the modern applications, web or mobile, store
user data. How do you think they do it? Yes, applications are programmed
in such a way that they collect user data and store the data on DBMS
Record Based Logical Model

🠶 These models specify logical structure of database with records,


fields and attributes.
🠶 Types of Record based logical model are:
▪ Relational Model
▪ Network Model
▪ Hierarchical Model
Relational model

🠶 In relational model, the data and relationships are represented


by collection of inter-related tables. Each table is a group of
column and rows, where column represents attribute of an
entity and rows represents records.
🠶 In this model, data is organized in two-dimensional tables and
the relationship is maintained by storing a common field.
🠶 Hence, tables are also known as relations in relational model.
Structure of Relational Model
Hierarchical Model
🠶 In hierarchical model, data is organized into a tree like structure
with each record is having one parent record and many children.
🠶 The hierarchy starts from the Root data, and expands like a tree,
adding child nodes to the parent nodes.
🠶 In this model, a child node will only have a single parent node.
🠶 This model efficiently describes many real-world relationships like
index of a book, recipes etc.
🠶 for example, one department can have many courses, many
professors and many students.
Structure of Hierarchical Model
Network Model

🠶 This is an extension of the Hierarchical model. In this model data is


organized like a graph, and are allowed to have more than one
parent node.
🠶 In this database model data is more related as more relationships are
established in this database model. Also, as the data is more related,
hence accessing the data is also easier and fast.
🠶 This was the most widely used database model, before Relational
Model was introduced.
Structure of Network Model
What is RDBMS?

🠶 RDBMS stands for Relational Database Management System. RDBMS is


the basis for SQL, and for all modern database systems like MS SQL
Server, IBM DB2, Oracle, MySQL, and Microsoft Access.
🠶 A Relational database management system (RDBMS) is a database
management system (DBMS) that is based on the relational model as
introduced by E. F. Codd.
What is a table?
The data in an RDBMS is stored in database objects which are called
as tables. This table is basically a collection of related data entries and it
consists of numerous columns and rows.
Remember, a table is the most common and simplest form of data storage in a
relational database
The following program is an example of a CUSTOMERS table −

ID | NAME | AGE | ADDRESS | SALARY |


+----+----------+-----+-----------+----------+
| 1 | Ramesh | 32 | Ahmedabad | 2000.00 |
| 2 | Khilan | 25 | Delhi | 1500.00 |
| 3 | kaushik | 23 | Kota | 2000.00 |
| 4 | Chaitali | 25 | Mumbai | 6500.00 |
| 5 | Hardik | 27 | Bhopal | 8500.00 |
| 6 | Komal | 22 | MP | 4500.00 |
| 7 | Muffy | 24 | Indore | 10000.00 |
🠶 What is a Record or a Row?
🠶 A record is also called as a row of data is each individual entry that exists
in a table. For example, there are 7 records in the above CUSTOMERS
table. Following is a single row of data or record in the CUSTOMERS
table −

+----+----------+-----+-----------+----------+
| 1 | Ramesh | 32 | Ahmedabad | 2000.00 |
+----+----------+-----+-----------+----------+
A record is a horizontal entity in a table.
🠶 What is a column?
🠶 A column is a vertical entity in a table that contains all information
associated with a specific field in a table.
🠶 For example, a column in the CUSTOMERS table is ADDRESS, which
represents location description and would be as shown below −
+-----------+
| ADDRESS |
+-----------+
| Ahmedabad |
| Delhi |
| Kota |
| Mumbai |
| Bhopal |
| MP |
🠶 Features of RDBMS Systems:
• All data stored in the tables are provided by an RDBMS
• Ensures that all data stored are in the form of rows and columns
• Facilitates primary key, which helps in unique identification of the rows
• Index creation for retrieving data at a higher speed
• Facilitates a common column to be shared amid two or more tables
• Multi-user accessibility is facilitated to be controlled by individual users
• A virtual table creation is enabled to store sensitive data and simplify
queries

You might also like