# use bookstore;

select *
from customers;

select customers.firstname, customers.lastname, customers.age
from customers;

select count(*)
from customers
where customers.age > 30;

select count(*)
from customers
where customers.age > 30
  AND customers.age < 40;

select *
from customers
where title = 'Frau Dr.'
   OR title = 'Herr Dr.';

select *
from customers
where (title = 'Frau Dr.' OR title = 'Herr Dr.')
  AND age < 30;

select count(distinct customers.lastname)
from customers;

select count(customers.age)
from customers
where age < 30;

select distinct customers.firstname
from customers;

select distinct customers.firstname, lastname
from customers;

select count(distinct customers.firstname)
from customers;

# Aufgabe SELECT

select count(*)
from baby_names; # 220636

select count(*)
from baby_names
where gender = 'm'; # 94322

select `count`
from baby_names
where name = 'Alex'
  and year = 2010
  and gender = 'm';

select count(distinct baby_names.name)
from baby_names; # 6809

select count(distinct baby_names.name)
from baby_names
where gender = 'm'; # 2756
select count(distinct baby_names.name)
from baby_names
where gender = 'f'; # 4535

select *
from baby_names
where `count` = 19250; # Sandra

select *
from baby_names
where gender != 'm'
  and gender != 'f';

select distinct baby_names.gender
from baby_names; # M, F

select count(distinct baby_names.name, baby_names.gender)
from baby_names;