Computer ScienceChapter 4: Data and Analysis
4.2.2 Dataset and Database
Dataset:
Explanation level
This topic explains the difference between a dataset and a database, how databases are managed using DBMS, and provides examples of relational and non-relational databases.
Definition
Dataset: A dataset is a structured or organized collection of data, which is usually associated with a unique body of work.
Database: A database is an organized collection of data stored in multiple datasets or tables. These tables can be accessed electronically from the computer system for further manipulation and update.
Core Concept
A dataset is like a single folder containing related documents. A database is like a whole filing cabinet with many folders, organized so you can find and update information easily. If you have a dataset of student names and grades, that's one folder. A database would contain that folder plus folders for courses, teachers, and fees—all connected and managed together. A DBMS (Database Management System) is like the librarian who helps you add, find, and update files in the cabinet.
Detailed Explanation
Dataset
A dataset is a structured or organized collection of data, which is usually associated with a unique body of work.
- Organized collection of data.
- Associated with a specific project or purpose.
- Can be a single table or multiple related tables.
- Example: A collection of brain CT scans of brain tumor patients used to evaluate patterns.
Database
A database is an organized collection of data stored in multiple datasets or tables. These tables can be accessed electronically from the computer system for further manipulation and update.
- Organized collection of data.
- Stored in multiple datasets or tables.
- Accessed electronically.
- Can be manipulated and updated.
- Requires a DBMS for management.
Database Management System (DBMS)
To perform actions on the data stored in a database, we need a Database Management System (DBMS) . DBMS is the interface between the database and the end user, providing a platform to create, modify, and retrieve data. There are many different database management systems available, depending on the type of database being used.
- Create databases and tables.
- Modify data (insert, update, delete).
- Retrieve data (query, search).
- Manage security and access.
- Ensure data integrity and consistency.
Relational Databases
Relational databases store data in tables (relations) with rows and columns. They are managed by database management systems such as MySQL, Oracle, MS-Access, and IBM Db2. These are the most used databases in Data Science, for data which is presented in a tabular format.
- Data stored in tables (rows and columns).
- Uses Structured Query Language (SQL).
- Relationships between tables via keys.
- Examples: MySQL, Oracle, MS-Access, IBM Db2.
Non-Relational Databases
Non-relational databases store data in forms such as key-value pairs, column families, or graphs. They are managed by database management systems like MongoDB and Cassandra. Non-relational DBMS are also called NoSQL DBMS.
- Data stored in flexible formats (documents, key-value, graphs).
- No fixed schema.
- Scalable and flexible.
- Examples: MongoDB, Cassandra.
Comparison of Relational and Non-Relational Databases
| Feature | Relational | Non-Relational (NoSQL) |
|---|---|---|
| Data Storage | Tables (rows/columns) | Key-value, document, graph, column-family |
| Schema | Fixed | Flexible |
| Query Language | SQL | Varies (MongoDB query, etc.) |
| Scalability | Vertical | Horizontal |
| Examples | MySQL, Oracle, MS-Access | MongoDB, Cassandra |
| Use Case | Structured data | Unstructured/semi-structured data |
Example: Online Shopping Website Database
To further understand how a database is helpful to store data, consider online shopping websites. The products shown on the websites are stored in a database. To manage the products, customers, and their orders, a specific database is maintained.
Tables: Product, Customer, Orders
Product Table:
| Product ID | Product Name | Price | Stock Quantity | Expiry Date |
|---|---|---|---|---|
| Pd001 | Chocolate 50Gm | Rs. 250 | 700 | June 2026 |
| Pd002 | Honey 500Gm | Rs. 1000 | 150 | December 2027 |
Customer Table:
| Cust. ID | Customer Name | Email ID | Contact Number | Address |
|---|---|---|---|---|
| Cust001 | Ali Ahmad | ali@gmail.com | 03901597535 | 152 main road Islamabad |
| Cust005 | Shagufta Asad | sasad@gmail.com | 03624569852 | 78 DHA Phase-II Karachi |
Order Table:
| Order ID | Cust. ID | Product ID | Qty. | Order Date | Status | Payment |
|---|---|---|---|---|---|---|
| Os987 | Cust005 | Pd002 | 2 | 4 February, 2025 | Pending | COD |
| Os873 | Cust001 | Pd002 | 5 | 6 February, 2025 | Shipped | Paid |
- Customers visit the website, choose products, and add them to the cart.
- They select quantity and mode of payment and place the order.
- The database stores all this information and provides ease of product and order management.
- School library system.
- Hotel management system.
- Student management system.
Intermediate Level
A dataset is an organized collection of data for a specific purpose. A database is a structured collection of data stored in multiple tables, accessible electronically. A DBMS (Database Management System) is the interface between the database and the user, allowing creation, modification, and retrieval of data. Relational databases (MySQL, Oracle) store data in tables with rows and columns and use SQL. Non-relational databases (MongoDB, Cassandra) store data in flexible formats like key-value pairs or documents. Databases are essential for managing large amounts of data in applications like online shopping, library systems, and hotel management.
Important Points
- - Dataset: organized collection of data for a specific purpose.
- - Database: organized collection of data stored in multiple tables.
- - DBMS: interface between database and user.
- - Relational databases: tables, SQL, MySQL, Oracle, MS-Access, IBM Db2.
- - Non-relational databases: flexible formats, MongoDB, Cassandra (NoSQL).
- - Online shopping database example: Product, Customer, Orders tables.
- - Databases are essential for managing large amounts of data.
Remember
- - Dataset: Collection of related data.
- - Database: Multiple datasets/tables organized.
- - DBMS: Interface to manage database.
- - Relational: Tables, SQL (MySQL, Oracle).
- - Non-Relational: Flexible (MongoDB, Cassandra).
- - Example: Product, Customer, Orders tables.
- - Databases: School library, hotel management, student management.
Common Mistakes
- - Confusing dataset and database: A dataset is a collection; a database is an organized system of multiple datasets.
- - Thinking all databases are relational: Non-relational (NoSQL) databases also exist.
- - Forgetting the role of DBMS: DBMS is the interface for managing the database.
- - Mixing up SQL and NoSQL: SQL is for relational; NoSQL is for non-relational.
- - Assuming databases are only for large companies: Databases are used in many applications, from small apps to large enterprises.
Quick Revision
A dataset is a structured collection of data for a specific purpose. A database is an organized collection of data stored in multiple tables, accessible electronically. A DBMS (Database Management System) is the interface between the database and the user. Relational databases (MySQL, Oracle) store data in tables and use SQL. Non-relational databases (MongoDB, Cassandra) store data in flexible formats. Databases are essential for managing large amounts of data in applications like online shopping, library systems, and hotel management.
60-Second Revision
- Dataset: Collection of related data.
- Database: Organized collection of multiple datasets/tables.
- DBMS: Interface to manage database.
- Relational: Tables, SQL (MySQL, Oracle).
- Non-Relational: Flexible (MongoDB, Cassandra).
- Example: Product, Customer, Orders tables.
- Key Point: A dataset is a single collection; a database is an organized system of multiple datasets managed by a DBMS.
Did you understand this topic?
Your answer is saved with your learning record. It does not mark the topic as mastered.
Quick revision
Revision Zone
Review the key facts, formulas and checks before you move on.4.2.2 Dataset and Database
Sticky Notes · Quick Revision
Key Point 1
- Dataset: Collection of related data.
Key Point 2
- Database: Organized collection of multiple datasets.
Key Point 3
- DBMS: Interface to manage database.
Key Point 4
- Relational: Tables, SQL (MySQL, Oracle).
Key Point 5
- Non-Relational: Flexible (MongoDB, Cassandra).
Key Point 6
- Example: Product, Customer, Orders.
Key Point 7
- Databases: Library, Hotel, Student Management.
Same supplied content as this Notes page (shared canonical source).