My question is simple. How can I compose a query in which I negate something? And I'm not refer to NOT condition. For example I have to select all the tourists that booked at least one pension(acc\_type\_code) whose rating is greater than 9, but did not book any 3 star hotel with a rating less than 9?

My tables:

Tourist

```
id (pk)
name
email

```

Booking

```
id_tourist (pk)
id_accomodation (pk)

```

Accomodation

```
id_accomodation (pk)
acc_type_code (fk)
nr_of_stars
rating
price

```

Accomodation type

```
acc_type_cde (pk)
acc_type_name

```

What I've tried:

```
SELECT t.id as id_tourist, t.name, t.email from Tourist t,
JOIN Booking b on (t.id = b.id_tourist)
JOIN Accomodation a on (b.id_accomodation = a.id_accomodation)
JOIN AccType at on (a.acc_type_code = at.acc_type_code)
WHERE a.rating > 9 AND .. ?

```

And here I'm blocked. Any suggestions?