Advertisement
Guest User

Untitled

a guest
Jan 21st, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. -- Question 1 : Give the list of teachers (name) and the name of the courses that they are teaching and the name of the courses that they are reviewing.
  2. -- Hint: There will be a list of teacher names (first and last), teaching courses, reviewing courses.
  3. -- write the query here
  4. select name, surname, course_name, review.course_code
  5. from teacher join teach on teacher.bsn = teach.bsn join course on teach.course_code = course.course_code join review on course.course_code = review.course_code;
  6. -- Question 2: Give the list of students that completed their study programs together with their course points (sum of all the course points for each student).
  7. -- Hint: There will be a list with first name and last name of students and total points of courses that each student followed.
  8. -- write the query here
  9. select name, surname, sum(study_points)
  10. from study_program join completed on study_program.course_program = completed.course_program
  11. join student on completed.student_id = student.student_id
  12. join teach on student.student_id = teach.student_id
  13. join course on teach.course_code = course.course_code
  14. group by name, surname;
  15. -- Question 3: Give the list of courses (names) that teachers with maximum scale are teaching.
  16. -- write the query here
  17. select distinct course_name, name, surname
  18. from course join teach on course.course_code = teach.course_code
  19. join teacher on teach.bsn = teacher.bsn
  20. where scale = (select max(scale) from teacher);
  21. -- Question 4: Give the list of students (names) and their assignments together with the number of prerequisites for each assignment.
  22. -- Hint: There will be a list of students names, code of the assignment, code of the course of the assignment, total number assignments that are required to do the assignment.
  23. -- write the query here
  24. select name, surname, are_given.a_code, are_given.course_code, count(is_required_a_code)
  25. from student join are_given on student.student_id = are_given.bsn
  26. join assignment on are_given.a_code = assignment.a_code
  27. join requirement on assignment.a_code = requirement.required_a_code
  28. group by name, surname, are_given.a_code, are_given.course_code;
  29. -- Question 5: Give a list of teachers (names) that are teaching courses, but do not work on assignments
  30. -- write the query here
  31. select distinct name, surname
  32. from teach join teacher on teach.bsn = teacher.bsn
  33. where teacher.bsn not in (select bsn from work_on);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement