---
# System prepended metadata

title: Exercícios Resolvidos para Aula - Aula 9

---

# Exercícios Resolvidos para Aula - Aula 9

Questão 1.
```sql
    select category, count(*) from times
    group by category order by count(*) desc;
```

Questão 2.

```sql
    select * from times where birth_year between 1920 and 1965 and birth_year not between 1945 and 1955;
```

Questão 3.

```sql
select * from times
where death_year is null and birth_year is not null order by birth_year asc limit 1;
```

Questão 4.

```sql
select * from times
where birth_year = (
        select min(birth_year)
        from times
        where death_year is null and birth_year is not null
    );
order by year asc
limit 1
```

Questão 5.

```sql
select count(*) from times where category = 'Revolution' or category = 'Technology' or category = 'Science';
```

Questão 6.

```sql
select count(*) from times where category in ('Revolution', 'Technology', 'Science');
```

Questão 7.

```sql
select * from times
where birth_year in (
select birth_year from times
where birth_year is not null
group by birth_year order by count(*) desc limit 1);
```

