5. When would you use a flat file database versus a relational database? In your answer, explain when you would use each.

A flat file database would be used when there is a relatively small amount of data and a simple structure. It is essentially a text file that stores all the data in a single table, with each record or line representing a single entity. Flat file databases are easy to create and manage, as they do not require complex database management systems.

One common use case for a flat file database is when storing data for simple applications or personal projects with fewer data requirements. For example, a small online store that only needs to store product names, prices, and quantities in stock could efficiently use a flat file database. Similarly, a spreadsheet or CSV file can serve as a flat file database for managing a mailing list or storing survey responses.

On the other hand, a relational database would be used when dealing with larger and more complex datasets that require structured organization and relationships between different entities. Relational databases consist of multiple related tables, with each table representing a specific entity or concept. They allow for data normalization, ensuring efficient storage and data integrity through the use of primary and foreign keys.

Relational databases shine in scenarios with multiple entities or tables that need to be linked together. For instance, enterprise-level customer relationship management (CRM) systems require a relational database to manage customer data, orders, transactions, and any other related data. By structuring the data and establishing relationships between tables, relational databases enable robust querying, data consistency, and scalability.

In summary, flat file databases are suitable for small-scale, simple applications with limited data requirements, while relational databases are more appropriate for larger, complex datasets that demand structured organization and data relationships.