CS403 – Database Management
Systems
Assignment No. 02 (Spring 2025)
Question No. 1: INSERT SQL Statements
Following are the SQL queries to insert one record into each table:
-- Insert into Students table
INSERT INTO Students (student_id, first_name, last_name, date_of_birth, gender, email,
phone, admission_date)
VALUES (1, 'Ali', 'Khan', '2002-03-15', 'Male', '[Link]@[Link]', '03001234567',
'2023-08-01');
-- Insert into Courses table
INSERT INTO Courses (course_id, course_name, department, credits, instructor_name)
VALUES (101, 'Database Systems', 'Computer Science', 4, 'Dr. Ayesha Noor');
-- Insert into Enrollments table
INSERT INTO Enrollments (enrollment_id, student_id, course_id, enrollment_date, grade)
VALUES (1001, 1, 101, '2024-02-20', 'A');
Question No. 2: SQL Queries Based on Statements
The table below contains SQL queries corresponding to the given statements:
Statement SQL Query
List all students born between 2000 and SELECT * FROM Students WHERE
2005 (follow the format YYYY-MM-DD). date_of_birth BETWEEN '2000-01-01' AND
'2005-12-31';
Find all courses in the 'Computer Science' SELECT * FROM Courses WHERE
or 'Mathematics' departments. department IN ('Computer Science',
'Mathematics');
List courses with more than 3 credits, SELECT * FROM Courses WHERE credits >
ordered by credits in descending order. 3 ORDER BY credits DESC;
List students enrolled in more than 3 SELECT student_id FROM Enrollments
courses. GROUP BY student_id HAVING
COUNT(course_id) > 3;
Find students who are enrolled after SELECT DISTINCT Students.* FROM
January 31, 2023. Students JOIN Enrollments ON
Students.student_id =
Enrollments.student_id WHERE
enrollment_date > '2023-01-31';