# Exercícios de Back-end 25/07/2020
## 1 - Questão
```sql
select distinct
category, count(name)
from
times
group by category
order by count(name) desc;
```
## 2 - Questão
```sql
select
year,
honor,
name
from
times
where
birth_year between 1920 and 1965
and birth_year not between 1945 and 1955
limit 5
```
## 3 - Questão
```sql
select
year,
honor,
name
from
times
where
birth_year is not null
and death_year is null
order by birth_year asc
limit 1
```
## 4 - Questão
```sql
select
*
from
times
where
name in (
select
name
from
times
where
birth_year is not null
and death_year is null
order by birth_year asc
limit 1
)
```
## 5 - Questão
```sql
select
count(*)
from
times
where
category like 'Revolution'
or category like 'Technology'
or category like 'Science'
```
## 6 - Questão
```sql
select
count(*)
from
times
where
category in ('Revolution','Technology','Science')
```
## 7 - Questão
```sql
select
year,
honor,
name
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
)
```
## 8 - Questão
### I
```sql
select distinct
honor
from
times
where
year <= 1998;
```
### II
```sql
--- Mulheres -----
select distinct
honor
from
times
where
year <= 1998
and honor like 'Wom_n%';
--- Homens -----
select distinct
honor
from
times
where
year <= 1998
and honor like '%M_n%';
```
### III
```sql
select
honor,
name
from
times
where
year >= 1998;
```
Apenas 1 mulher, após a mundaça de dos nomes.
### IV
Os direitos das mulheres, que nunca foram iguais aos dos homens.