Zwischenstand

This commit is contained in:
Max W.
2025-01-26 13:19:18 +01:00
parent 20a40bd225
commit 0eae775942
3 changed files with 124 additions and 3 deletions

View File

@@ -0,0 +1,82 @@
# 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;