relational division - Record that is related to all records of other table in SQL -


Assume that we have three tables in a relational database:

  person {id , Name} constraint {id, name} Person_overcomes_obstacle {person_id, obstacle_id}  

I want to write a question which tells me that at least one person has overcome all obstacles ?

I think I was the only person using the Natural table nickname for Person_overcomes_obstacle !

You need a query for this.

You can either calculate the barriers and matching records in Personal_operates_bustakal and return to them, where 2 numbers are found or some other way to find it, to find people, For which they do not have any obstacles that they are not far away.

  SELECT p.id, p.name / * or if you do not care about the ID and name *, then use the wrap (*) in the existing (or) or not. * O from the obstacle where not present (Select * For Person_Operver_Obestackle Pie WHERE poo.person_id = p.id and o.id = poo.obstacle_id))  

Comments