0% found this document useful (0 votes)
36 views2 pages

CS403 Assignment 2

The document contains SQL queries for a Database Management System assignment, including data insertion for Students, Courses, and Enrollments tables. It also includes queries to list students born between 2000 and 2005, find courses in specific departments, and identify students enrolled in more than three courses. Additionally, it provides a query to find enrollments after January 31, 2023.

Uploaded by

furqanhaider5t
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views2 pages

CS403 Assignment 2

The document contains SQL queries for a Database Management System assignment, including data insertion for Students, Courses, and Enrollments tables. It also includes queries to list students born between 2000 and 2005, find courses in specific departments, and identify students enrolled in more than three courses. Additionally, it provides a query to find enrollments after January 31, 2023.

Uploaded by

furqanhaider5t
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

CS403

Database Management System

Assignment 2

Question 1:

Student Table:

INSERT INTO Students (student_id, first_name, last_name, date_of_birth, gender, email, phone,
admission_date)

VALUES (1, 'Ayesha', 'Khan', '2002-08-15', 'F', '[Link]@[Link]', '03001234567', '2021-09-


01');

Course Table:

INSERT INTO Courses (course_id, course_name, department, credits, instructor_name)

VALUES (101, 'Database Systems', 'Computer Science', 4, 'Dr. Ahmed Raza');

Enrollment Table:

INSERT INTO Enrollments (enrollment_id, student_id, course_id, enrollment_date, grade)

VALUES (1001, 1, 101, '2023-02-10', 'A');

Question 2:

Statement Write SQL Query Here.


List all students born between 2000 and 2005 SELECT * FROM Students
(follow the format YYYY-MM-DD). WHERE date_of_birth BETWEEN '2000-01-01'
AND '2005-12-31';
Find all courses in the 'Computer Science' or SELECT * FROM Courses
'Mathematics' departments. WHERE department IN ('Computer Science',
'Mathematics');
List courses with more than 3 credits, ordered by SELECT * FROM Courses
credits in descending order. WHERE credits > 3
ORDER BY credits DESC;
List students enrolled in more than 3 courses. SELECT student_id
FROM Enrollments
GROUP BY student_id
HAVING COUNT(course_id) > 3;
Find students who are enrolled after January 31, SELECT * FROM Enrollments
2023. WHERE enrollment_date > '2023-01-31';

You might also like