A database is optimized for data storage and data retrieval. When you put data into a database table, the database table can be indexed in a variety of ways so that depending on what column or columns you are searching by, the data can always be found as quickly as possible.
One of the ways that the databases do this, is by loading as much data into RAM as possible into what is called the buffer cache. This cache holds all the data that has been recently used within the database, so that it can be found faster than by looking for it on the disk. As the data in the cache becomes unused it is marked to be flushed so that if new data needs to be loaded into cache the database can make room for it.
Database servers also support multiple people reading and writing the data at the same time. Databases allow for locks to be taken on specific rows, data pages, or entire tables depending on the need at the time, so that while one person is performing a transaction against the database other users can’t update those records, pages, or tables until the first transaction has completed.
Billions of dollars have been spent developing the major database platforms out there. They have been made to be extremely flexible and extremely fast so long as the database has been designed and tuned correctly.
MrDenny is right on the money. I would add that a DBMS (database management system) allows you to define data relationships within the database, which will then be propagated to any program that runs against the database. Thus, at the database level, you can ensure that a part number entered on an order is a valid part number (part number on order must exist in parts master table) and that if an order is deleted, all the order lines are deleted along with the header (order number in lines table must exist in the orders table). Thus, data integrity is enforced at the database level rather than having to be enforced in every program that operates on the data, which is very powerful. I hope this helps.