Databases are organized collections of structured information or data that can be easily accessed, managed, and analyzed. The data stored in a database can take many forms. For example, authentication systems use databases to store and verify user credentials such as usernames and passwords. Social media platforms like Instagram and Facebook store user-generated data such as posts, comments, and likes. Similarly, streaming services like Netflix maintain records of user activities, such as watch history, which are later analyzed to generate personalized recommendations.
TYPES:
| Relational Databases |
| Non-Relational Databases |
Relational Databases (RDBMS)
- Store structured data that follows a defined format or schema.
- Example: User data fields may include first_name, last_name, email_address, username, and password.
- When a new user registers, a new record (row) is added to the database following this structure.
- Data is stored in tables organized into rows and columns:
- Rows → represent individual records.
- Columns → represent attributes or fields.
- Relationships can be created between two or more tables (e.g., user and order_history tables).
- These relationships enable efficient data management and retrieval.
- The term “relational” comes from the ability to relate data across multiple tables.
- Relational database is data stored in a tabular format and they are also known as SQL databases)
Non-relational Databases (NoSQL)
- Data stored in a non-tabular format, unlike relational databases.
- Do not require a fixed schema or structure for the data.
- Suitable for storing unstructured or semi-structured data.
- Example: When documents are scanned, they may contain varying types and quantities of data that do not fit neatly into rows and columns.
- Such data is stored in non-relational databases, which can handle flexible and diverse data formats.
- Common data models used include:
- Document-based (e.g., MongoDB)
- Key-value (e.g., Redis)
- Column-family (e.g., Cassandra)
- Graph-based (e.g., Neo4j)
- Ideal for use cases where data relationships are less structured or where scalability and flexibility are priorities.