Practical 1a
Practical 1a
This exercise is designed to help students design, implement, and manipulate a small relational
database for a school management system using MySQL, SQL Server, PostgreSQL, SQLite, or Microsoft
Access.
Objective:
• Learn to write basic SQL queries (CREATE, INSERT, UPDATE, DELETE, SELECT).
1. Open MySQL Workbench (or any chosen database software) and create a new database called
SchoolDB.
SQL Code:
USE SchoolDB;
FirstName VARCHAR(50),
LastName VARCHAR(50),
Age INT,
CourseID INT,
CourseName VARCHAR(100),
InstructorID INT,
);
FirstName VARCHAR(50),
LastName VARCHAR(50),
Department VARCHAR(50)
);
SQL Code:
('Algebra', 2),
('Physics 101', 3);
FROM Students
UPDATE Students
SET Age = 23
FROM Students
GROUP BY Courses.CourseName;
Part 4️: Indexing and Constraints (10 minutes)
1. Test the Queries – Run each query and verify the output.
2. Modify the Database – Try adding a new instructor and a new course.
3. Discussion Questions:
o How would you expand this database for a larger school system?
Expected Outcomes
By the end of this 1-hour practical exercise, students should be able to:
Create relational tables with primary and foreign keys.
Write basic SQL queries to insert, update, delete, and retrieve records.
Perform JOIN operations to combine data from multiple tables.
Use indexing and constraints to optimize and secure data.
This hands-on approach makes database learning engaging and practical, preparing students for real-
world applications in business, IT, and software development.