A simple SQL project I built to practice working with relational databases. It covers creating tables, inserting data and writing queries — from basic selects all the way to subqueries and aggregations.
The database has three tables — students, courses and enrollments. Students can enroll in multiple courses and each enrollment has a grade attached to it.
schema.sql— creates the three tablesdata.sql— adds sample students, courses, and enrollmentsqueries.sql— 11 queries ranging from basic to advanced
- View all students and courses
- Filter students by city
- Find students who got an A grade
- Count total number of students
- Show each student with their enrolled course and grade
- Count how many students are in each course
- Find students who scored an A along with the course name
- Find students enrolled in more than one course and count their A grades
- Calculate the percentage of A grades per course
- Find the best grade each student achieved using a subquery
You can paste the files in order into DB Fiddle and run them directly in the browser no installation needed.