Professional Documents
Culture Documents
DatabaseFundamentals AnuragNepal
DatabaseFundamentals AnuragNepal
Course Description
This database course is designed for novices who want to learn the practical aspects of working with databases. The course covers both SQL (using
MySQL) and NoSQL (using MongoDB) databases, providing a comprehensive understanding of relational and non-relational database concepts.
Students will gain hands-on experience in designing, implementing, and managing databases, as well as building database-driven web applications.
Course Structure
Total Hours: 25 hours
The course consists of 20 chapters, with the total time allocation being 25 hours. Each chapter focuses on specific topics and includes practical
activities and assignments to reinforce learning.
Chapter 19: Grocery Store Application with Python and MySQL 2 hours
LEARNING OUTCOME
By the end of this chapter, students will be able to:
• Define what a database is and understand its role in modern applications.
• Differentiate between SQL and NoSQL databases.
• Successfully set up a MySQL database.
Live Demonstration:
• Walk students through the MySQL setup process.
• Provide practical tips and troubleshoot common issues.
Classroom Discussion:
• Encourage students to ask questions and share their thoughts.
• Foster a collaborative learning environment.
Hands-On Practice:
• Encourage students to practice SQL commands during the MySQL setup.
ASSIGNMENT
Task students with setting up a MySQL database on their own, following the provided guidelines.
LEARNING OUTCOME
By the end of this chapter, students will be able to:
• Understand the fundamental concepts of tables, rows, and columns in a relational database.
• Differentiate between primary keys and foreign keys and their significance in database design.
• Explain the concepts of normalization and denormalization and their impact on database performance.
• Apply entity-relationship (ER) modeling techniques to represent relationships between entities.
Classroom Discussion:
• Encourage students to ask questions and participate in discussions.
• Foster a collaborative learning environment.
Hands-On Activities:
• Provide exercises to practice identifying primary keys and foreign keys.
• Assign a group project to create an ER diagram for a given scenario.
ASSIGNMENT
Task students with normalizing a given set of data and creating an ER diagram based on a provided scenario.
Live Demonstration:
• Demonstrate the process of creating tables and manipulating data using SQL.
• Provide practical tips and troubleshoot common issues.
Hands-On Practice:
• Assign exercises to practice writing SQL statements for table creation, data manipulation, and table structure modification.
• Encourage students to experiment with different scenarios.
ASSIGNMENT
Task students with creating a database schema, populating it with sample data, and performing various SQL operations, such as inserting, updating,
deleting, and modifying table structure.
LEARNING OUTCOME
By the end of this chapter, students will be able to:
• Retrieve data from a database using SELECT statements.
• Apply filters and sorting techniques to refine query results.
• Understand and utilize joins to combine data from multiple tables.
• Use subqueries to perform complex queries and obtain specific data subsets.
Live Demonstration:
• Demonstrate the process of retrieving data, applying filters, performing joins, and using subqueries.
• Provide practical tips and troubleshoot common issues.
Hands-On Practice:
• Assign exercises to practice writing SELECT statements with filters, sorting, joins, and subqueries.
• Encourage students to experiment with different scenarios and analyze query results.
ASSIGNMENT
Task students with retrieving specific data from a given database using SELECT statements with filters, sorting, joins, and subqueries. Ask them to
explain the rationale behind their queries and analyze the results obtained.
LEARNING OUTCOME
By the end of this chapter, students will be able to:
• Understand the concept of triggers in SQL and their usage in automating actions based on database events.
• Comprehend transactions and their role in maintaining data integrity and consistency.
• Explore indexing techniques to improve query performance and optimize database operations.
PROGRESSION OF TOPICS (1 HOUR)
Triggers in SQL (20 minutes)
• Exploring the concept of triggers and their implementation in SQL.
• Understanding different types of triggers and their usage scenarios.
Live Demonstration:
• Demonstrate the implementation of triggers and transactions in SQL.
• Provide practical tips for indexing and query optimization.
Hands-On Practice:
• Assign exercises to practice writing triggers, performing transactions, and optimizing queries using indexing techniques.
• Encourage students to analyze the impact of triggers, transactions, and indexing on database performance.
ASSIGNMENT
Task students with designing and implementing triggers for specific database events, performing transactions to maintain data integrity, and
optimizing queries using indexing techniques. Ask them to analyze the performance improvements achieved through their implementations.
LEARNING OUTCOME
By the end of this chapter, students will be able to:
• Apply performance tuning techniques to optimize SQL queries and improve database performance.
• Utilize advanced joins and subqueries to retrieve complex data from multiple tables.
• Optimize slow-performing SQL queries using indexing and query rewriting techniques.
PROGRESSION OF TOPICS (1 HOUR)
Performance Tuning Techniques (20 minutes)
• Exploring various techniques to improve the performance of SQL queries.
• Understanding query execution plans and query optimization tools.
Live Demonstration:
• Demonstrate the process of optimizing SQL queries using indexing and query rewriting techniques.
• Provide practical tips for performance tuning and query optimization.
Hands-On Practice:
• Assign the task of optimizing a slow-performing SQL query using indexing and query rewriting techniques.
• Encourage students to analyze the performance improvements achieved and explain their optimization strategies.
ASSIGNMENT
Task students with optimizing a given slow-performing SQL query using indexing and query rewriting techniques. Ask them to document their
optimization process, explain the rationale behind their choices, and measure the performance improvements achieved.
LEARNING OUTCOME
By the end of this chapter, students will be able to:
Collaborative Project: Build a Database-Driven Web Application Using MySQL (30 minutes)
• Forming teams and assigning roles for the collaborative project.
• Designing the architecture and user interface of the web application.
• Implementing the backend using MySQL as the database.
• Integrating the frontend and backend to create a functional web application.
Hands-On Practice:
• Assign exercises to practice designing and implementing a database schema for a library management system.
• Encourage students to collaborate and work in teams to build a database-driven web application using MySQL.
• Provide guidance and support throughout the practical activities and projects.
ASSIGNMENT
Task students with designing and implementing a database schema for a library management system. Ask them to consider the requirements
discussed in the chapter and document their schema design, including tables, relationships, and attributes. Additionally, assign them to collaborate
with their peers to build a database-driven web application using MySQL. Ask them to design the architecture, implement the backend using
MySQL, and integrate the frontend to create a functional web application. Finally, ask them to document their process, provide an analysis of their
implementation, and discuss any challenges faced and lessons learned during the project.
LEARNING OUTCOME
By the end of this chapter, students will be able to:
Live Demonstration:
• Demonstrate the process of setting up MongoDB and performing basic operations.
• Provide practical tips and troubleshoot common issues.
Hands-On Practice:
• Assign exercises to practice setting up MongoDB and performing basic operations, such as inserting, updating, and querying documents.
• Encourage students to explore different use cases where NoSQL databases can be beneficial.
ASSIGNMENT
Task students with setting up MongoDB on their own and performing various operations, such as creating databases, collections, and documents.
Additionally, ask them to research and present a use case where a NoSQL database would be a suitable choice, explaining the benefits it provides
over a traditional SQL database.
LEARNING OUTCOME
By the end of this chapter, students will be able to:
Live Demonstration:
• Demonstrate the process of inserting, updating, and deleting documents in MongoDB.
• Provide practical tips and troubleshoot common issues.
Hands-On Practice:
• Assign exercises to practice creating databases and collections, as well as performing operations on documents in MongoDB.
• Encourage students to experiment with different scenarios and functionalities.
ASSIGNMENT
Task students with creating a MongoDB database, designing collections, and performing operations such as inserting, updating, and deleting
documents. Ask them to document their process and provide examples of the commands used for each operation.
LEARNING OUTCOME
By the end of this chapter, students will be able to:
Hands-On Practice:
• Assign exercises to practice querying data, implementing indexing, and designing a MongoDB schema for a blogging platform.
• Encourage students to analyze the performance improvements achieved through indexing and explain their schema design choices.
ASSIGNMENT
Task students with designing a MongoDB schema for a blogging platform. Ask them to identify the entities, relationships, and attributes necessary
for the platform and document their schema design. Additionally, assign them to perform queries on a given MongoDB collection using MongoDB's
query language and explain the results obtained.
LEARNING OUTCOME
By the end of this chapter, students will be able to:
Live Demonstration:
• Demonstrate the process of designing document structures and schemas in MongoDB.
• Provide practical tips for making design decisions and modeling relationships.
Hands-On Practice:
• Assign exercises to practice designing document structures and schemas for different scenarios.
• Encourage students to analyze the trade-offs between embedding and referencing data and justify their design choices.
ASSIGNMENT
Task students with designing document structures and schemas for a given set of scenarios. Ask them to explain their design choices and discuss
the benefits and drawbacks of embedding and referencing data in each scenario.
LEARNING OUTCOME
By the end of this chapter, students will be able to:
• Utilize the aggregation framework in MongoDB to perform complex queries and data analysis.
• Understand the concepts of geospatial data and indexing in MongoDB.
• Implement a MongoDB aggregation pipeline to analyze sales data.
Live Demonstration:
• Demonstrate the process of using the aggregation framework and indexing for geospatial data in MongoDB.
• Provide practical tips for designing the aggregation pipeline and optimizing geospatial queries.
Hands-On Practice:
• Assign exercises to practice using the aggregation framework and indexing for geospatial data in MongoDB.
• Encourage students to analyze the results obtained from the aggregation pipeline and interpret the data.
ASSIGNMENT
Task students with implementing a MongoDB aggregation pipeline to analyze sales data. Provide them with a dataset and specific requirements for
the analysis. Ask them to design the aggregation pipeline, execute it, and interpret the results obtained. Additionally, encourage them to optimize
the pipeline and explore the usage of indexing for geospatial queries if applicable.
LEARNING OUTCOME
By the end of this chapter, students will be able to:
Live Demonstration:
• Demonstrate the process of migrating data between SQL and NoSQL databases using relevant tools and techniques.
• Provide practical tips and troubleshoot common issues.
Hands-On Practice:
• Assign exercises to practice evaluating different scenarios and selecting the appropriate database type.
• Encourage students to analyze the trade-offs and challenges involved in data migration between SQL and NoSQL databases.
ASSIGNMENT
Task students with evaluating different scenarios and selecting the appropriate database type (SQL or NoSQL) based on given requirements. Ask
them to justify their choices by considering the pros and cons of each database type. Additionally, assign them to research and present a case study
of a real-world data migration between SQL and NoSQL databases, discussing the challenges faced and the strategies employed during the
migration process.
LEARNING OUTCOME
By the end of this chapter, students will be able to:
Assignment: Design a Database Schema for a Library Management System (30 minutes)
• Assigning a project to design a database schema for a library management system.
• Providing guidelines for identifying entities, relationships, and attributes relevant to the library management system.
• Guiding students in creating an ER diagram, mapping it to a database schema, and optimizing the structure.
Hands-On Practice:
• Assign exercises to practice requirements analysis, ER diagram creation, and database schema design for different scenarios.
• Encourage students to analyze the trade-offs and make design decisions based on the given requirements.
ASSIGNMENT
Task students with designing a database schema for a library management system. Ask them to identify the entities, relationships, and attributes
necessary for the system and document their schema design. Additionally, encourage them to optimize the structure of the database by applying
normalization techniques and explain the rationale behind their design choices.
LEARNING OUTCOME
By the end of this chapter, students will be able to:
Hands-On Practice:
• Assign exercises to practice implementing security measures in databases, such as parameterized queries, input validation, and encryption.
• Encourage students to analyze the impact of data privacy regulations on database security and discuss compliance requirements.
ASSIGNMENT
Task students with analyzing a given database system for security vulnerabilities and proposing measures to secure it against unauthorized access.
Ask them to document their findings and recommendations. Additionally, assign them to research and present a case study of a data breach and
discuss the lessons learned from a security perspective.
LEARNING OUTCOME
By the end of this chapter, students will be able to:
Live Demonstration:
• Demonstrate the process of performing a database backup and restore operation using MySQL.
• Provide practical tips for monitoring performance, implementing optimization strategies, and troubleshooting common issues.
Hands-On Practice:
• Assign exercises to practice implementing backup and recovery strategies, monitoring performance, performing database maintenance tasks,
and troubleshooting common issues.
• Encourage students to analyze the results obtained from the backup and restore operation and verify the data integrity.
ASSIGNMENT
Task students with performing a database backup and restore operation using MySQL. Ask them to select an appropriate backup strategy, execute
the backup and restore operations, and verify the data integrity. Additionally, assign them to document their process and provide an analysis of the
backup and restore operation, including any challenges faced and lessons learned.
LEARNING OUTCOME
By the end of this chapter, students will be able to:
Live Demonstration:
• Demonstrate the techniques for achieving scalability and high availability in database applications.
• Provide practical tips for integrating databases with big data frameworks and analytics tools.
Hands-On Practice:
• Assign exercises to practice evaluating scalability and high availability considerations for database applications.
• Encourage students to explore the integration of databases with big data frameworks and perform basic analytics tasks.
ASSIGNMENT
Task students with researching and presenting a case study of a real-world database-driven application. Ask them to analyze the database
architecture, design choices, and performance considerations in the application. Additionally, assign them to explore the scalability and high
availability considerations for a given database application scenario and propose appropriate techniques. Finally, encourage them to research and
discuss the role of databases in big data and analytics, including the challenges and considerations involved.
LEARNING OUTCOME
By the end of this chapter, students will be able to:
Live Demonstration:
• Demonstrate the process of working with blockchain databases, graph databases, time-series databases, and integrating machine learning/AI
techniques in databases.
• Provide practical tips and showcase relevant tools and technologies.
Hands-On Practice:
• Assign exercises to practice working with blockchain databases, graph databases, time-series databases, and implementing machine
learning/AI techniques in databases.
• Encourage students to explore real-world use cases and discuss the benefits and challenges of these emerging technologies in the database
field.
ASSIGNMENT
Task students with researching and presenting a case study or application scenario for one of the emerging technologies discussed in this chapter
(blockchain databases, graph databases, time-series databases, or machine learning/AI in databases). Ask them to analyze the benefits, challenges,
and potential use cases for the chosen technology. Additionally, assign them to explore and discuss the future trends and advancements in the field
of databases related to these emerging technologies.
LEARNING OUTCOME
By the end of this chapter, students will be able to:
Integrating MySQL Database for Product Inventory and Customer Information (20 minutes)
• Creating a MySQL database schema for managing product inventory and customer information.
• Connecting the Python application to the MySQL database using appropriate libraries.
Implementing CRUD Operations for Managing Products and Customers (30 minutes)
• Implementing Create, Read, Update, and Delete (CRUD) operations for managing products and customers in the application.
• Handling user input, validating data, and interacting with the MySQL database.
Live Demonstration:
• Demonstrate the process of setting up a Python development environment, integrating a MySQL database, implementing CRUD operations,
handling transactions, and generating sales reports in the application.
• Provide practical tips and troubleshoot common issues.
Hands-On Practice:
• Assign exercises to practice setting up a Python development environment, integrating a MySQL database, implementing CRUD operations,
handling transactions, and generating sales reports in the application.
• Encourage students to analyze the results obtained from the application and discuss potential improvements or additional features.
ASSIGNMENT
Task students with building a local grocery store application using Python and MySQL. Ask them to design the application architecture, set up a
Python development environment, integrate a MySQL database for managing product inventory and customer information, implement CRUD
operations for managing products and customers, handle transactions, and generate sales reports. Additionally, assign them to document their
process, provide an analysis of the application's functionality, and suggest potential improvements or additional features.
CHAPTER 20: CREATING A SOCIAL MEDIA DATABASE WITH MONGODB
20.1 Understanding the requirements of a social media platform
20.2 Designing the database schema for user profiles, posts, and relationships
20.3 Implementing user authentication and authorization
20.4 Storing and retrieving user-generated content using MongoDB
20.5 Implementing features like following/followers, likes, and comments
20.6 Handling real-time updates and notifications
LEARNING OUTCOME
By the end of this chapter, students will be able to:
• Understand the requirements of a social media platform and the corresponding database design considerations.
• Design a MongoDB schema for user profiles, posts, and relationships in a social media context.
• Implement user authentication and authorization in a social media database.
• Store and retrieve user-generated content using MongoDB.
• Implement features like following/followers, likes, and comments in a social media database.
• Handle real-time updates and notifications in a social media database.
Designing the Database Schema for User Profiles, Posts, and Relationships (30 minutes)
• Discussing the design considerations for user profiles, posts, and relationships in a social media context.
• Exploring different approaches for modeling relationships, such as following/followers, likes, and comments.
Hands-On Practice:
• Assign exercises to practice implementing user authentication and authorization, storing, and retrieving user-generated content, and
implementing features like following/followers, likes, and comments in a social media database.
• Encourage students to explore real-world use cases and discuss the challenges and considerations involved in handling real-time updates and
notifications.
ASSIGNMENT
Task students with designing a MongoDB schema for a social media platform of their choice. Ask them to consider the requirements discussed in
the chapter and document their schema design, including user profiles, posts, relationships, and additional features like following/followers, likes,
and comments. Additionally, assign them to implement user authentication and authorization, store and retrieve user-generated content, and
handle real-time updates and notifications in their social media database. Ask them to provide a detailed analysis of their implementation,
including any challenges faced and potential improvements or optimizations.