This repository contains a collection of SQL exercises focused on database design, data manipulation, and advanced querying techniques. The exercises simulate real-world use cases, such as university and college systems, to demonstrate SQL operations such as database creation, table structures, and querying for specific data insights.
The repository is organized into multiple folders, each containing exercises related to different aspects of MySQL database management. The exercises cover topics from creating and structuring databases to complex queries involving data filtering, aggregation, and relational integrity.
-
Activity 1: University Database
Focuses on simulating a university database for managing *students, **courses, **professors, **classes, and *student grades.Examples of exercises:
• Query to find students with grades below 5 in a specific course.
• Calculate the average grades of students in a particular course.
• Retrieve a list of students who are not from the same city. -
Activity 2: College Database
This section demonstrates a college management system that handles *student data, **professor details, **class schedules, and *department information.Exercises include:
• Data insertion and table creation for college-related entities.
• Altering table structures to match changing requirements (e.g., increasing field sizes).
-
Clone the Repository
To begin using the repository, clone it to your local machine using your preferred Git client. This can be done with the following command:git clone https://github.com/your-username/repository-name.git
-
Import Database Scripts After cloning the repository, import the SQL scripts contained in the relevant folder into your MySQL database. This will create the necessary tables and insert sample data for you to work with.
-
Querying the Data Once the data is set up, you can start running SQL queries to interact with it. For example, you might want to execute queries to retrive students who have a grade below 5 in a particular course, calculate the average grades of students in a given course, or find students who are from cities outside of your main location.
-
Learning Outcomes By working through these exercises, you will:
- Gain hands-on experience in designing relational databases;
- Practice writing SQL queries to manipulate and extract data;
- Explore different scenarious sch as data aggregation, foreign key relationships, and database integrity.
• MySQL Database
• SQL - Structured Query Language
• Relational Database Management Systems - RDBMS
Feel free to contribute by opening pull requests or submitting issues related to database structures, queries, or additional exercises.
This project is licensed under the MIT License.