---
# System prepended metadata

title: 'Questão 4:'

---

## Questão 1:

```
select cervejarias."name" as "cervejaria", cervejas.ibu, cervejas.abv, cervejas.name, cervejas.style 
from cervejarias
inner join cervejas
on cervejas.brewery_id = cervejarias.id
where cervejas.ibu > 60
and cervejarias.state = 'TX'
and cervejas."style" <> 'American IPA'
and cervejas."style" <> 'American Double / Imperial IPA';
```

## Questão 2: 

```
select cervejas.style, count(cervejas.style) 
from cervejas
where
cervejas.name <> cervejas.style
group by cervejas.style 
order by count desc limit 5;
```

## Questão 3:

```
select cervejarias."state"
from cervejas
inner join cervejarias
on cervejas.id = cervejarias."id"
where 
cervejas.abv < 0.05 and 
cervejas.ibu > 15 
group by cervejarias."state" limit 1 
offset 11;
```

# Questão 4:

### (Maior amargor)

```
select cervejarias."name", count(ounces)
from cervejarias
inner join cervejas
on cervejas.brewery_id = cervejarias."id"
where 
ibu >= 40
group by cervejarias."name"
order by count(ounces) desc
limit 5;
```


### (Maior Teor Alcóolico)

```
select cervejarias."name", count(ounces)
from cervejarias
inner join cervejas
on cervejas.brewery_id = cervejarias."id"
where 
abv > 0.070
group by cervejarias."name"
order by count(ounces) desc
limit 5;
```

## Questão 5:

```
select cervejarias."state", count(ounces)
from cervejarias
inner join cervejas
on cervejas.brewery_id = cervejarias."id"
where 
ibu < 40 and 
abv > 0.070
group by cervejarias."state"
order by count(ounces) desc
limit 1;
```

## Questão 6:

```
select cervejarias."city", cervejarias."state",  count(ounces)
from cervejarias
inner join cervejas
on cervejas.brewery_id = cervejarias."id"
where 
abv < 0.070 and 
ibu >= 40
group by cervejarias."city", cervejarias."state"
order by count(ounces) desc
limit 1;
```
