Informations

Auteur(s) Quentin Cappart
Date limite Pas de date limite
Limite de soumission Pas de limite

Se connecter

Lecture de requêtes SQL (plusieurs relations)

Traduisez le plus précisément possible les requêtes SQL suivantes. N'hésitez pas à exécuter ces requêtes dans SQLite pour vérifier votre compréhension.


Question 1:
select student.name
from student, advisor, instructor
where student.ID = advisor.s_ID
      and advisor.i_ID = instructor.ID
      and instructor.dept_name = 'Biology';
Question 2:
select course.title
from course, section
where course.course_id = section.course_id
     and section.year = 2024
     and section.semester = 'Fall';
Question 3:
select instructor.name
from instructor, teaches, course
where instructor.ID = teaches.ID
      and teaches.course_id = course.course_id
      and course.dept_name = 'Physics'
      and instructor.salary > 80000;
Question 4:
select student.name
from student, takes, course
where student.ID = takes.ID
      and takes.course_id = course.course_id
      and course.credits = 3
      and student.dept_name = 'Biology';
Question 5:
select classroom.building
from classroom, section
where classroom.building = section.building
      and classroom.room_number = section.room_number
      and section.course_id = '787';
Question 6:
select student.name
from student, advisor, instructor
where student.ID = advisor.s_ID
      and advisor.i_ID = instructor.ID
      and (instructor.salary > 90000 or student.tot_credit > 100);
Question 7:
select course.course_id
from course, prereq
where course.course_id = prereq.course_id
      and prereq.prereq_id = '608';
Question 8:
select time_slot.day, time_slot.start_hr, time_slot.start_min
from time_slot, section
where time_slot.time_slot_id = section.time_slot_id
      and section.semester = 'Spring'
      and section.year = 2024;
Question 9:
select instructor.name
from instructor, teaches, section
where instructor.ID = teaches.ID
      and teaches.course_id = section.course_id
      and teaches.sec_id = section.sec_id
      and teaches.semester = section.semester
      and teaches.year = section.year
      and section.building = 'Watson';
Question 10:
select student.name
from student, takes, teaches
where student.ID = takes.ID
      and takes.course_id = teaches.course_id
      and takes.sec_id = teaches.sec_id
      and takes.semester = teaches.semester
      and takes.year = teaches.year
      and teaches.ID = 22591;