I couldn't find the advantages and disadvantages of using a database over plain files. Would you please help me?
-
5I daresay you didn't look well enough... homework, no enthusiasm, voting to close. – markus Jan 20 '10 at 08:22
-
Also related: [database vs. flat files](http://stackoverflow.com/q/2356851), [When/why should I start using a database?](http://stackoverflow.com/q/3945368), and [Database vs Flat Text File: What are some technical reasons for choosing one over another when performance isn't an issue?](http://stackoverflow.com/q/1499239) – Cody Gray - on strike Jul 31 '13 at 06:54
2 Answers
A few database advantages:
- Highly optimized (indexing, query optimization)
- Stores many different types of data, generally with type-safety
- Prebuilt abstractions (SQL, database access layers)
- Relational integrity (foreign key constraints, etc)
- ACID (Mostly having to do with data integrity, check Wikipedia...)
- Interactive queries (for debugging, running ad-hoc reporting, etc)
Plain text doesn't have much except for the most dead-simple application
- Can inspect on-disk format
- Extremely simple in every way
- No need for a server or linked library, etc.
Basically, if you are doing anything other than the most simple data manipulation (especially if you ever expect to have concurrent modifications, complex relations, multiple users, or even just a lot of data) it's well worth getting used to using a database. PostgreSQL is my favorite, although I'm sure you'll find conflicting views on that one :)

- 37,580
- 14
- 81
- 100
-
You can add concurrency and security to the pros of a database. – Pascal Thivent Jan 20 '10 at 08:16
-
can we say that we can do delete,insert and update and search in DB that we can not do it for plain files? – Johanna Jan 20 '10 at 08:18
-
+1. "No need for a [software] server" can be achieved with (R)DMS as well: http://www.sqlite.org/ – Jørn Schou-Rode Jan 20 '10 at 08:20
-
@Johanna: It is most certainly possible to modify a "plain file" - it usually just requires more work. – Jørn Schou-Rode Jan 20 '10 at 08:22
-
Jørn Schou-Rode: You're completely right, of course. You still have to link with an additional library, though. Give plain text a break, it's not like it had much going for it in the first place ;-) – Steven Schlansker Jan 20 '10 at 18:23
Enforcement of standards.
Improved data accessibility and responsiveness.
Increased productivity.
Improved maintenance through data independence.
Increase concurrency.
Improved backup, recovery and data availability.
Control of data redundancy.
Data consistency.
More information from the same amount of data.
- Data Warehousing, Data mining
Sharing of data.
Improved data integrity.
Improved security.

- 11
- 1