CompTIA Tech+ (FC0-U71)Data and Database FundamentalsEasy
A startup needs to store product catalog data where each product may have a completely different set of attributes (some have size and color, others have wattage and voltage). The schema will change frequently. Which type of database is the best fit?
- AA spreadsheet workbook
- BA relational database with a fixed table schema
- CA non-relational (NoSQL) document database
- DA single flat CSV file
Show answer & explanationAnswer & explanation
Correct answer: C. A non-relational (NoSQL) document database
Non-relational (NoSQL) document databases store data in flexible, schema-less documents, making them ideal when records have varying attributes. Relational databases require a fixed schema of predefined columns, which doesn't fit varying product attributes well.
Why the other options are wrong
- A. Spreadsheets aren't designed for large, variable-schema data storage.
- B. Relational databases enforce a rigid schema, poor fit for varying fields.
- D. Flat files lack structure for querying varied attributes efficiently.
Relational vs Non-relational Databases
Relational databases use structured tables with fixed schemas and SQL; non-relational (NoSQL) databases use flexible formats like documents, key-value pairs, or graphs.
- Relational = tables, rows, columns, fixed schema
- NoSQL = flexible schema, good for unstructured/varied data
- Examples: MySQL (relational), MongoDB (NoSQL document)
Memory trick: Relational = Rigid rows; NoSQL = No-fixed Shape