0% found this document useful (0 votes)
9 views

EX06 SQL Query

Uploaded by

buidangduy243
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

EX06 SQL Query

Uploaded by

buidangduy243
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

TEACHING MANAGEMENT

STUDENT (StudentID, StudentName, DateOfBirth, Address)


SUBJECT (Subject ID, SubjectName)
TEACHER (Teacher ID, TeacherName, TeacherAddress)
COURSE (Course ID, CourseName,FeesPay)
TEACHING (Course ID, Teacher ID)
SUBJECT_ENROLMENT(StudentID, SubjectID,FeesPaidDate)

STUDENT

StudentID StudentName DateOfBirth Address

1 Nguyễn Văn A 10-05-2001 Hà Nội

2 Trần Thị B 15-02-2000 Hồ Chí Minh

3 Lê Văn C 20-09-2002 Đà Nẵng

4 Phạm Thị D 30-01-2000 Hải Phòng

5 Nguyễn Văn E 11-11-1999 Cần Thơ

6 Trần Văn F 22-07-2001 Biên Hòa

7 Lê Thị G 05-08-2002 Nha Trang

8 Nguyễn Văn H 18-04-1998 Huế

9 Phạm Văn I 25-12-2003 Quy Nhơn

10 Trần Thị J 30-06-2001 Vũng Tàu

SUBJECT:
SubjectID SubjectName

101 Toán

102 Lý

103 Hóa

104 Văn

105 Tiếng Anh

106 Giáo Dục Công Dân


TEACHER
TeacherID TeacherName TeacherAddress

201 Lê Văn K Hà Nội

202 Trần Thị M Đà Nẵng

203 Nguyễn Văn N Hồ Chí Minh

204 Phạm Thị O Hải Phòng

COURSE

CourseID CourseName FeesPay

301 Toán Cơ Bản 1200000

302 Lý Cơ Bản 1200000

303 Hóa Nâng Cao 2700000

304 Văn Tăng Cường 3200000

SUBJECT_ENROLMENT
StudentID SubjectID FeesPaidDate

1 101 2023-01-15

1 102 2023-02-20

1 105 2023-03-10

2 101 2023-04-05

2 103

3 102 2023-01-10

3 104 2023-05-18

4 105 2023-06-01

5 103

6 101 2023-02-28

7 102 2023-03-15

8 104 2023-01-01

9 105

10 101 2023-04-12
1. Retrieve all students from the STUDENT table.
2. Find the name and address of the student with StudentID = 1.
3. List all subjects in the SUBJECT table.
4. Find the name of the teacher with TeacherID = 202.
5. Retrieve the course name for the course with CourseID = 301.
6. Find all students who were born after '2000-01-01'.
7. Retrieve all students who live in 'Hà Nội'.
8. List all teachers who live in 'Đà Nẵng'.
9. Find all subjects where the fees paid is greater than 400000.
10. List all students who have paid fees after '2023-01-01'.
11. Find the names of students who are enrolled in at least 2 different subjects.
12. Retrieve the details of students who have not yet paid their fees for any subject.
13. Find the total fees paid by the student with StudentID = 1.
14. List all courses taught by the teacher with TeacherID = 201.
15. Find all subjects that have at least one student enrolled.
16. Retrieve the names of students enrolled in the subject with SubjectID = 101.
17. Find the teachers who teach the course with CourseID = 303.
18. List all students who share the same date of birth as Lê Văn K.
19. Retrieve the list of subjects along with the number of students enrolled in each.
20. Find the total number of courses each teacher teaches.
21. Find the names of students who have paid their fees but have not yet enrolled in any courses.
22. List the subjects that have more than 5 students enrolled but less than 3 have paid their fees.
23. Find the names of teachers who teach courses that do not have any students enrolled.
24. Retrieve the students who have paid the highest fees for any subject.
25. List all courses where every student enrolled has already paid their fees.
26. Find the teachers who live in the same city as more than 3 students.
27. Retrieve the students who are enrolled in more than one subject.
28. List all students along with the total fees they have paid, sorted by the total fees.
29. Find the courses that are taught by at least 2 different teachers.
30. Retrieve the details of all students who have enrolled in a subject but haven't paid their fees
yet.

You might also like