Good evening, could you help me write the correct requests to delete data from the database? The task is that, according to a certain branch ID, you must also remove the groups that include the students of the groups. I understand that this should be done with 3 different requests, but I do not fully understand how to get a list of IDs from groups and how to use it to remove students. Approximately the structure of the database: enter image description here

  • If in the forehead, then the delete from students where group in(select id from groups where department_code in(...) and so on going deep - Mike
  • one
    Ummm ... and ON DELETE CASCADE would not it be better? - Akina

0