- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Distinguish between flat files and databases (dbms)?
Let’s discuss flat and database definition before understanding the difference between flat files and databases.
Flat files
A flat file contains records which have no structured interrelationship. They are typically called as a text file, where all word processing, structure characters and markup have been removed. A flat file represents a table with a single record per line. Generally, it is a type of database that stores data in a plain text format.
Database
The related information when placed in an organized form that makes a database or an organized collection of related information is called a database.
For example − Dictionary, Telephone directory etc.
Differences
Following are the differences between flat files and database:
Difference with respect to data storage
Data storage is a way of keeping information in the memory storage for use by a computer. An example of data storage is a folder for storing Microsoft Word documents.
Flat files − File size is limited and we need many files to store relevant data. Since data is spread across files it is a time-consuming process to look into all files to get the required data.
An example for the data stored in one file is as follows −
Student | Branch | Teacher |
---|---|---|
Pinky | CSE | Mr.Bob |
Hari | CSE | Mr.Bob |
Kittu | ECE | Mr.Pratap |
Jim | ECE | Mrs.Jhansi |
Here,
In the flat file, the storage space is wasted. CSE branch teacher is stored twice.
We can also see that in the above table, there exists a problem of inconsistency with regards to the flat files. There arises a question as to who is ECE branch teacher.
Database − Data related to the same is stored in one single place. It is easy to look into a single place to get all required data.
For example − In a database, data is stored in multiple linked tables.
Consider the student file as shown below −
Student | Branch |
---|---|
Pinky | CSE |
hari | CSE |
Kittu | ECE |
Jim | ECE |
Branch file
The branch file with details about branch and its respective teacher is given below −
Branch | Branch Teacher |
---|---|
CSE | Mr.Bob |
ECE | Mr.Pratap |
Difference with respect to data retrieval
Data retrieval is the process of identifying and extracting data from a database, based on a query given by the user.
Flat files − Data in flat files are stored in an unstructured way because of which retrieval becomes difficult.
For example − A bunch of different vegetables are placed in one big basket. If we want to pick chilies from the basket, it will be very difficult as it is a time consuming job.
Database − Retrieval is easy since data is stored in structured way in the form of rows and columns
For example: The meaning of structured way is that all the vegetables in the supermarket are arranged in a proper manner, so that searching, inserting, deleting a particular vegetable becomes very easy.
Difference with respect to data security
Data security is the process of protecting the data from unauthorised persons.
Flat files − Text files having confidential information stored in a desktop can be viewed by anyone who has access to the system. Therefore, data security is low in flat files.
For example − The general example to explain the flat file security is hiding or saving the money in an open bag, so that everyone can view the money.
Database − Data security is high because data stored in databases have login credentials to view permitted data.
For example − Storing or saving the money in a locker which provides more security, so the database is also like a locker.
Important point
In mobile phones, flat files still exist because retrieving them is easy. Here, the storing capacity is low and security is also low.