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

30 SQL Practice Exercises

ff

Uploaded by

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

30 SQL Practice Exercises

ff

Uploaded by

karthikstudy0
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 3
9114124, 659,AM Schema md2pd- Markdown to POF Let's use a new schema with the following tables: Student , Course , Enrollment , Instructor , and Department Student Table student id name 1 Alice Smith 2 Bob Johnson 3 Carol White 4 Dave Brown 5 Eve Davis Course Table course _id name 1 Math 101 2 English 101 3 History 101 4 Science 101 5 Art 101 Enrollment Table enrollment id student id 1 1 2 1 3 2 4 2 5 3 6 3 7 4 intpsutma2pat.netity.app age 20 21 23 course_id 1 2 gender department_id __enrollment_date 1 2021-09-01 2 2020-09-01 1 2021-01-15 3 2019-09-01 2 2021-09-01 instructor_id 1 2 grade 18 9114124, 659,AM md2pa- Markdown to POF enrollmentid studentid courseid grade 8 4 2 B 9 5 3 A Instructor Table instructor_id name department id 1 Prof. Adams 1 2 Dr. Baker 2 3 Prof. Clark 3 Department Table departmentid name 1 Science 2 Arts 3 History Queries Intermediate and Advanced Queries (30) Find all students who are enrolled in at least one course. List the names of students who are not enrolled in any courses. Find the average grade for each student. List the courses along with the number of students enrolled in each course. Find the department with the highest number of students. List all students along with the total credits they are enrolled in. Find the courses taught by ‘Prof. Adams’. List students who have enrolled in both ‘Math 101’ and ‘Science 101: @PNAWNAWNS 9. Find the highest grade achieved in each course, 10, List the courses with more than 2 students enrolled, 11. Find the total number of students enrolled in each department. 12. List the instructors along with the number of courses they teach. 13, Find the students who have achieved a grade of ‘A’ in all their courses. 14, List the courses that are not taken by any student 15. Find the number of male and female students in each department. epsitmdzpatnetity. app 28 9114124, 659,AM md2pd- Markdown to POF 16. 17. 18. 19. 20, 21 22, 23, 24, 25, 26, 27. 28, 29, 30, List students who enrolled in courses in the current year Find the students who have taken all the courses offered by their department. List the students and their average grades, ordered by the average grade in descending order. Find the instructors who teach courses in more than one department. List the departments and the total number of credits offered by each. Find students who have not enrolled in any course in the 'Science' department. List the students and their highest grades in any course. Find the courses with no grades lower than ' List the students along with the names of the courses they are enrolled in, ordered by student name and course name Find the instructors who do not teach any courses. List the courses that have been taken by students from multiple departments. Find the total number of courses taught by each instructor, ordered by the number of courses in descending order. List the students who have enrolled in courses worth more than 10 credits. Find the departments with the average student age less than 21 List the students who have never received a grade of 'C’ or lower. intpsutma2pat.netity.app 33

You might also like