A flat file database is one in which data is stored in plain text format. It is usually used to store and retrieve a small amount of data in a local text file.
| Name | Class | Age |
| John | 9 | 15 |
| Susan | 6 | 11 |
| Emili | 10 | 15 |
When we store such a table in a flat file database file structure will be as follows.
John^^9^^15
Susan^^6^^11
Emili^^10^^15
Here I use a new string "^^" as column separator, and new line character is used for row separation. While selecting such a separator we must confirm that data itself not contain that string. So we have to filter-out data from such string before any write operation.
1. A flat file is a SISO (serial in serial out) memory system. New data can only be entered at the end of the file. So if we want to edit or delete a record from our database; or if we want to insert a new record in-between two records, we have to rearrange and then rewrite the entire database file. So speed of operation lowers with the size of database file. Actually flat file database should not be used for size more than 5mb.
2. Flat file database is not very safe in multi-user environment like blog, guestbook etc. where many users sharing the same database from different ends.