DB Lab Task-03.docx
DB Lab Task-03.docx
Lab 03:
SQL
Lab Instructor:
Amala Masood
Date: 24-02-2025
Introduction to SQL
Objective:
Instructions:
UPDATE Students
SET Email = 'alice.new@example.com'
WHERE FirstName = 'Alice' AND LastName = 'Johnson';
Bonus Challenge:
1. Create a view that displays all students along with their enrolled courses.
CREATE VIEW StudentCourses AS
SELECT Students.StudentID, Students.FirstName,
Students.LastName, Courses.CourseName
FROM Students
JOIN Enrollments ON Students.StudentID = Enrollments.StudentID
JOIN Courses ON Enrollments.CourseID = Courses.CourseID;
2. Retrieve all students who are not enrolled in any course.
SELECT * FROM Students
WHERE StudentID NOT IN (SELECT StudentID FROM Enrollments);
Expected Outcome:
● Understanding of SQL queries for creating, retrieving, updating, and deleting records.
● Hands-on practice with joins, group by, views, and subqueries.
● A functioning Student Management Database with relational integrity.
Submission: